diff --git a/patterns/object-group-card.html b/patterns/object-group-card.html index f49b0d7..348be09 100644 --- a/patterns/object-group-card.html +++ b/patterns/object-group-card.html @@ -117,7 +117,9 @@ } const referenceWidth = referenceCard.getBoundingClientRect().width; - grid.style.setProperty('--layout-object-card-shared-width', `${referenceWidth}px`); + const maxWidth = parseFloat(getComputedStyle(referenceCard).maxWidth); + const sharedWidth = Number.isFinite(maxWidth) ? Math.min(referenceWidth, maxWidth) : referenceWidth; + grid.style.setProperty('--layout-object-card-shared-width', `${sharedWidth}px`); grid.classList.add('sg-object-card-grid--multi-row'); }); };