Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2072 by:
<wa-icon>elements in favor ofstartandendslots for opt-in, reliable styling.vertical-align: middleto<wa-badge>for consistent alignment regardless of the badge's content. (The original styles attempted to accommodate this by resizing slotted icons.)Why Slots?
The initial code I set out to remove was, in part, applying
margin-inline-end: var(--wa-space-2xs, 0.25em)to slotted icons. This is needlessly opinionated and fragile; it assumes icons are only placed before other badge content.Elsewhere, we do try CSS-only solutions to apply default icon spacing according to whether the icon is at the beginning or end of the supplied content. Take this example from
<wa-tab>:But this doesn't actually work. Because content in the default slots of components like

<wa-tab>are typically plain text nodes, including<wa-icon>means that the icon matches both:first-childand:last-child. i.e., we get this:Slots give us much more reliable control of spacing, so it felt like the best approach for
<wa-badge>and seems worth considering for other components, too.@claviska, I'm 100% open to pushback if you think this is overkill!