From 5f6085a3a08f8d36cca20f9be0c825d7a53352ec Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Wed, 2 Apr 2025 22:32:44 -0700 Subject: [PATCH] Split CSS properties here to avoid a bug where 0-ing the padding values causes invalid calc() functions Fixes #39798, fixes #39370, closes #39873, undoes changes in #39373 --- scss/_modal.scss | 6 +++++- scss/_offcanvas.scss | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scss/_modal.scss b/scss/_modal.scss index ee58032ee8..a3492c1723 100644 --- a/scss/_modal.scss +++ b/scss/_modal.scss @@ -132,7 +132,11 @@ .btn-close { padding: calc(var(--#{$prefix}modal-header-padding-y) * .5) calc(var(--#{$prefix}modal-header-padding-x) * .5); - margin: calc(-.5 * var(--#{$prefix}modal-header-padding-y)) calc(-.5 * var(--#{$prefix}modal-header-padding-x)) calc(-.5 * var(--#{$prefix}modal-header-padding-y)) auto; + // Split properties to avoid invalid calc() function if value is 0 + margin-top: calc(-.5 * var(--#{$prefix}modal-header-padding-y)); + margin-right: calc(-.5 * var(--#{$prefix}modal-header-padding-x)); + margin-bottom: calc(-.5 * var(--#{$prefix}modal-header-padding-y)); + margin-left: auto; } } diff --git a/scss/_offcanvas.scss b/scss/_offcanvas.scss index eb2c97ab77..b40b2cd9b7 100644 --- a/scss/_offcanvas.scss +++ b/scss/_offcanvas.scss @@ -127,7 +127,11 @@ .btn-close { padding: calc(var(--#{$prefix}offcanvas-padding-y) * .5) calc(var(--#{$prefix}offcanvas-padding-x) * .5); - margin: calc(-.5 * var(--#{$prefix}offcanvas-padding-y)) calc(-.5 * var(--#{$prefix}offcanvas-padding-x)) calc(-.5 * var(--#{$prefix}offcanvas-padding-y)) auto; + // Split properties to avoid invalid calc() function if value is 0 + margin-top: calc(-.5 * var(--#{$prefix}offcanvas-padding-y)); + margin-right: calc(-.5 * var(--#{$prefix}offcanvas-padding-x)); + margin-bottom: calc(-.5 * var(--#{$prefix}offcanvas-padding-y)); + margin-left: auto; } }