Skip to content

fix(scraps): align leadingItems in compactSelect with check box/icon#106167

Merged
TkDodo merged 5 commits intomasterfrom
tkdodo/fix/compactSelect-leadingItems-alignment
Jan 15, 2026
Merged

fix(scraps): align leadingItems in compactSelect with check box/icon#106167
TkDodo merged 5 commits intomasterfrom
tkdodo/fix/compactSelect-leadingItems-alignment

Conversation

@TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Jan 13, 2026

in compactSelect, we wrap the checkbox (or check icon) inside a CheckWrap to align it properly with the text. Note that we can’t just use align-items: 'center' because the text can be multi-line, so flex-start is on purpose.

The leadingItems (which I didn’t know existed for compactSelect tbh) did not get this alignment, so icons inside it looked off.

This PR wraps leadingItems in the same Wrap as the check box/icon.

before:
Screenshot 2026-01-13 at 12 20 19

after:
Screenshot 2026-01-13 at 12 20 02

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 13, 2026
const checkboxSize = size === 'xs' ? 'xs' : 'sm';

if (hideCheck && !leadingItems) {
const leading =
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by refactoring: we weren’t checking the functional syntax of leadingItems in listBox, but gridList did implement it. This just streamlines behaviour.

@TkDodo TkDodo marked this pull request as ready for review January 13, 2026 12:59
@TkDodo TkDodo requested review from a team as code owners January 13, 2026 12:59
@TkDodo TkDodo merged commit 56c668f into master Jan 15, 2026
53 checks passed
@TkDodo TkDodo deleted the tkdodo/fix/compactSelect-leadingItems-alignment branch January 15, 2026 10:39
TkDodo added a commit that referenced this pull request Jan 23, 2026
TkDodo added a commit that referenced this pull request Jan 23, 2026
TkDodo added a commit that referenced this pull request Jan 26, 2026
JonasBa pushed a commit that referenced this pull request Jan 27, 2026
TkDodo added a commit that referenced this pull request Jan 27, 2026
…106972)

This is the second attempt to fix the alignment, after
#106167 was reverted because it
introduced an issue in the environment selector.

The problem was that, in order to do the alignment, we wrapped the
`leadingItems` again in another container, because the internally
created checkbox is also wrapped.

This fixed the alignment issue, however there are cases where
`hideCheck:true` is passed to hide the internal checkbox and then a
separate checkbox is rendered inside `leadingItems` 🤯 .

This is what `HybridFilter` does, and that checkbox should never get
wrapped because of how pointer events are handled.

The approach in this PR always just plainly returns the `leadingItems`
when `hideCheck` is passed to never do any wrapping. This is also what
happened before, but it’s now a bit more explicit. This is the important
change:


02cee3c

The rest are the exact changes re-applied from the reverted PR.

Note: I think `HybridFilter` only does this because it has an option to
also show the checkbox on the right side, which is used by the `Project`
selector. If we streamline this, like @Jesse-Box has planned, we can
probably just use the internal checkbox from `CompactSelect` and remove
all of these workarounds.
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants