Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@

- Add `SearchableSelectControl` component ([#80979](https://github.com/WordPress/gutenberg/pull/80979)).

### Bug Fixes

- `Select`, `SelectControl`, `Combobox`, `SearchableSelect`, `SearchableChipSelect`, `SearchableChipSelectControl`: Align the selected-item checkmark with the first line of the item label while keeping single-line items vertically centered. ([#82942](https://github.com/WordPress/gutenberg/pull/82942))

## 0.23.0 (2026-09-23)

### Breaking Changes
Expand Down
23 changes: 13 additions & 10 deletions packages/ui/src/form/primitives/combobox/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ export const Item = forwardRef< HTMLDivElement, ComboboxItemProps >(
ref={ ref }
{ ...restProps }
>
<Icon
icon={ variant === 'creatable' ? plus : check }
className={ clsx(
itemPopupStyles[ 'item-icon' ],
variant !== 'creatable' &&
itemPopupStyles[ 'item-indicator-icon' ]
) }
size={ 24 }
/>
{ children }
<span className={ itemPopupStyles[ 'item-icon' ] }>
<Icon
icon={ variant === 'creatable' ? plus : check }
className={ clsx(
variant !== 'creatable' &&
itemPopupStyles[ 'item-indicator-icon' ]
) }
size={ 24 }
/>
</span>
<div className={ itemPopupStyles[ 'item-content' ] }>
{ children }
</div>
</_Combobox.Item>
);
}
Expand Down
15 changes: 7 additions & 8 deletions packages/ui/src/form/primitives/select/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ export const Item = forwardRef< HTMLDivElement, SelectItemProps >(
{ ...itemAriaProps }
{ ...restProps }
>
<Icon
icon={ check }
className={ clsx(
itemPopupStyles[ 'item-icon' ],
itemPopupStyles[ 'item-indicator-icon' ]
) }
size={ size === 'small' ? 20 : 24 }
/>
<span className={ itemPopupStyles[ 'item-icon' ] }>
<Icon
icon={ check }
className={ itemPopupStyles[ 'item-indicator-icon' ] }
size={ size === 'small' ? 20 : 24 }
/>
</span>
<div className={ itemPopupStyles[ 'item-text' ] }>
{ contentChildren }
</div>
Expand Down
24 changes: 22 additions & 2 deletions packages/ui/src/utils/css/item-popup.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@
cursor: var(--wpds-cursor-control);
}

&:has(> .item-icon) {
display: grid;
grid-template-columns: auto minmax(0, 1fr);
align-items: start;
align-content: center;
}

&.is-size-small {
--wp-ui-popup-item-height: var(--wpds-dimension-size-sm);
--wp-ui-popup-item-padding-inline: var(--wpds-dimension-padding-sm);
Expand Down Expand Up @@ -175,15 +182,28 @@
}

.item-icon {
flex-shrink: 0;
display: flex;
align-items: center;
height: var(--wpds-typography-line-height-sm);
pointer-events: none;
}

.item-indicator-icon {
translate: 0 1px;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this necessary? It seems to move the elements out of alignment:

Image

I guess it's for visual alignment? Should we fix that in the icon?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The optical alignment matches a recent adjustment that we did for Menu checkmarks in #82346. I'm not sure if it's globally desirable that the icon itself be shifted, but that is a thing we can do, yes. (cc @fcoveram)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I confirm what Lena said, and propose that:

  • for the sake of this PR, we keep it;
  • separately, we consider applying the tweak to the icon itself and, if we do, remove translate styles added in this PR and in Menu

}

.item-content {
display: flex;
align-items: center;
gap: var(--wpds-dimension-gap-xs);
min-width: 0;
}

.item-text {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
flex: 1;
}

.item-label {
Expand Down
Loading