-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
Force left auto margin to be applied for modal and offcanvas header close buttons #39873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
louismaximepiton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, the same issue exists for the padding property above your changes.
For instance, if I'm setting $modal-header-padding-y: 0 !default; the x alignment is wrong because the padding of the button disappear just as the comment mentions.
Maybe if we want to resolve this issue, we should consider:
.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;
margin-left: auto; // Force the left margin of the close button to auto
}|
I don't have time to dig more into this right now, but there's also a possibility that our current version is correct (means that this PR should be closed) and that instead of setting $modal-inner-padding: 0px !default; // stylelint-disable-line length-zero-no-unitWithout unit added to
And https://drafts.csswg.org/css-values-4/#css-consistent-type:
I'll try to find more time to check that more in detail. |
mdo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me. Could maybe drop to margin and margin-left for an override, but no pressure either way.
…es causes invalid calc() functions Fixes twbs#39798, fixes twbs#39370, closes twbs#39873, undoes changes in twbs#39373
Description
This PR fixes the use case described in #39798 (comment) after a modification done in #39373.
IMHO, we don't need to reintroduce
justify-content: space-between. Withoutjustify-content: space-between, it offers more possibilities in terms of compositions for the modals and offcanvases headers. The issue seems to be limited to the special use case described in #39798 (comment).Whenever
$modal-inner-paddingis set to0(or$modal-header-padding-yand$modal-header-padding-xare set to 0), the following shorthand margin rule doesn't apply the auto margin left rule:It works manually when doing:
I suspect an issue with the combination of
calcand the actual values of the custom properties that could lead maybe to something kind of undefined or invalid. All the intermediate values in the shorthand rule are maybe undefined or invalid, making the entire rule invalid or equal to0;autonot being applied for the left-margin. It is evaluated as something likemargin: 0;in the end.When replacing the shorthand rule by the longhand rule, it seems now to work with the special case setting a 0 value.
Still based on my suspicion, even if the
calcrules (when setting a value to 0) are undefined or invalid, the longhand version allows having the right value for eachmargin-*rules:/cc @twbs/css-review for other ideas or a better technical analysis
Type of changes
Checklist
npm run lint)Live previews
Testing
Related issues
Closes #39798