-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Enable wrapping for elements in modal-footer #25103
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
> :not(:last-child) { margin-right: .25rem; } | ||
// Place margin between footer elements | ||
// stylelint-disable selector-max-universal | ||
> * { |
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.
This is a no-go for me—we avoid universal selectors like this whenever possible.
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.
@mdo Why?
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.
Hi @MartijnCuppens this PR explains it #25165
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.
I understand that we should use classes as much as possible. But in this case you don't know which elements are going to be placed in the .modal-footer
.
Also right now the following code is used to place margins between the elements:
// Easily place margin between footer elements
> :not(:first-child) { margin-left: .25rem; }
> :not(:last-child) { margin-right: .25rem; }
Imo this isn't more dogmatic as the use of the universal selector.
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.
Oh word, hmm. Those are also universal selectors since they'll match every elements first before limiting to last/first children. Both are bad generally speaking because they take much longer for browsers to parse and apply.
I wonder if a mix of these existing styles and a .modal-footer-item
would work? Or perhaps we just recommend spacing utils? A single universe selector is better than two though, too. Hmm...
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.
With spacing utils, there are some responsive issues (spacing between wrapped elements). Providing the .modal-footer-item
class would be the best solution if we want to prevent the use of the universal selector. Downside: It must be added to all children of the .modal-footer
and that would break all existing implementations of the modal.
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.
@mdo Have you made your mind up about this?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f9d48bc
to
6394687
Compare
We can now use the negative margin utility classes to fix this, but then still the 2 universal selectors ( @mdo, your call if we continue with this. |
869f9d6
to
46b362b
Compare
ec501c3
to
30e91ca
Compare
@twbs/css-review, this one is an older PR from me, but I think it's still relevant so I've added it to the |
Sorry @MartijnCuppens! Looking at this again, my concern here is that this could cause unintended side effects for folks who have put other items in their Should we instead limit the selector to |
No problem, @mdo! We did already target all elements (not only |
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.
Oh, yeah, I'm dumb. This looks good then!
Thanks for fixing this! 👏 👏 |
Sorry for resurrecting the dead but I was just wondering if anyone had thought about how to handle multiple paddings with this fix?
|
@karlsve, that won't be possible with the current implementation, but could be fixed by splitting the variable into |
As the Another way would be to somehow force the calculation to be done on all elements of a list of values. I have to admit that I am not sure if SASS / SCSS supports this in any way. It also seems to me like more people should be experiencing this issue as my team cannot be the only one which set the |
Fixes #24800.