Repository navigation
fix(site/src): show truncated filter labels and options in a tooltip - #32054
Conversation
…ping Options stay on one line and show the full label in a tooltip while highlighted and truncated. Reverts the per-page filter width bumps; the trigger tooltip covers those labels.
jeremyruppel
left a comment
There was a problem hiding this comment.
[reviewer-agent] round 1: changes needed at 3bbb8e2.
Scope, size (111 non-test lines), tickets, and required CI pass. The trigger tooltip works (shows on focus/hover only when truncated, Escape dismisses), verified in Storybook with the WCAG 1.4.12 spacing override. One blocking issue in the option tooltip, below.
Nits (optional):
- The option tooltip opens by itself when the dropdown opens, because cmdk highlights the first item. With the fix below, a keyboard user then needs two Escapes to close the dropdown. Fine to keep, but say so in the PR body.
Combobox.tsx:109:useCombobox().openstates the intent more directly thanprops["aria-expanded"].Combobox.tsx:244: use a namedComboboxItemLabelPropstype.SelectFilter.stories.tsx:101-121:LongLabelsgets its open, option-tooltip state only from the inherited metaplay. Name the two stories for their state (for exampleLongOptionHighlighted,TruncatedTriggerFocused) and makeplayexplicit on both.SelectFilter.test.tsx:97-107mostly duplicates theLongLabelsstory; the Escape regression test below is the more valuable one.
Follow-ups filed (pre-existing, not blocking):
- DEQ-636 SelectFilter dropdown dialog has no accessible name
- DEQ-635 ComboboxButton silently ignores className and children from callers
🤖 Generated by Coder Agents on behalf of @jeremyruppel.
| }, [isHighlighted]); | ||
|
|
||
| return ( | ||
| <Tooltip open={isTooltipOpen}> |
There was a problem hiding this comment.
[blocking] The option tooltip is controlled with no onOpenChange, and it sits above the popover in Radix's dismissable-layer stack, so it captures Escape. While a truncated option is highlighted, Escape neither dismisses the tooltip (WCAG 1.4.13 dismissible) nor closes the dropdown, which is a keyboard regression from main for every SelectFilter.
Repro: Storybook components/SelectFilter LongLabels with the spacing override, open the dropdown (first option is truncated and highlighted), press Escape three times: the dropdown and tooltip stay open. Only after ArrowDown to a short option does Escape close it. Reproduced independently in jsdom too; on main the first Escape closes the dropdown.
Suggested fix: handle close requests, e.g. onOpenChange={(open) => { if (!open) setIsTooltipOpen(false); }}, so the first Escape hides the tooltip and the next closes the dropdown. Add a regression test that presses Escape with a truncated option highlighted and asserts the tooltip is gone and then the trigger reports aria-expanded="false".
🤖 Generated by Coder Agents on behalf of @jeremyruppel.
The option tooltip captured Escape without closing, so the dropdown could not be closed by keyboard while a truncated option was highlighted. Also reads the popover state from the combobox context, names the ComboboxItemLabel props type, and names the long-label stories for the state they show.
jeremyruppel
left a comment
There was a problem hiding this comment.
Reviewed at 38ed012 after taking over from the author agent. The round 1 blocking issue is fixed: Escape now closes a truncated option's tooltip and then the dropdown, and a regression test covers it. The nits are addressed too. Follow-ups DEQ-635 and DEQ-636 track problems that already exist on main.
🤖 Generated by Coder Agents on behalf of @jeremyruppel.
Under WCAG 1.4.12 text spacing overrides (letter spacing 0.12em, word spacing 0.16em, line height 1.5), the
SelectFiltertrigger and options cut their labels off with no way to read the full text. Examples are "All providers" on AI Gateway sessions and "All resource types" and "All organizations" on the audit log.Nothing wraps. Labels stay on one line with an ellipsis, and a truncated label shows its full text in a tooltip:
ComboboxButtonshows the tooltip on hover and keyboard focus. It only opens if the label is truncated at that moment, so a spacing override applied after load is still caught. It stays closed while the dropdown is open.ComboboxItemLabelshows the tooltip while its option is highlighted, by pointer or arrow keys. cmdk options never get DOM focus, so the tooltip follows cmdk's highlighted value instead.SelectFilteroptions use it. cmdk highlights the first option when the dropdown opens, so a truncated first option shows its tooltip right away. Escape closes that tooltip first, and a second Escape closes the dropdown.Filter widths are unchanged from main. With the spacing override, "All providers" (109 > 98px), "All resource types" (156 > 148px) and "All organizations" still truncate at main widths, and the tooltip covers them.
ComboboxButtonis shared, so its form callers (workspace version, preset, IdP sync, AI budget dialogs) also get the tooltip when their selected value is truncated. That's additive: on main they truncated with no way to read the full text.The W3C Understanding document for 1.4.12 allows ellipses caused by spacing overrides "so long as the content is still available". The tooltip keeps the content available.
Closes DEQ-365
Closes DEQ-430
Grouping, decisions, and review notes
Grouping. The batch label
text-spacing-cut-offhad three eligible tickets with two root causes. DEQ-365 and DEQ-430 come from the sharedSelectFilter/ComboboxButtonand are fixed here. DEQ-434 comes fromStaticWidthin agent metadata and is fixed in #32055.Revisions.
Tooltip details.
Tooltips that compare the label'sscrollWidthto itsclientWidth.onOpenChange. The option tooltip opens from a layout effect whenuseCommandStatereports the option as highlighted, so it follows the arrow keys without focus moving.Verification.
pages/AuditPageAuditPage,pages/AIBridgePage/ListSessionsFilterDefault,components/SelectFilterLongOptionHighlighted and TruncatedTriggerFocused). Truncated triggers show their full label on hover and on focus. The highlighted long option shows its full label, arrow keys move the tooltip, and short options get none. Option heights stay 37 to 40px (one line).pnpm checkandtscare clean.OrganizationMembersPage.test.tsxfails 4 tests locally with main's components too, so it's unrelated.Accessibility audit (axe 4.11, WCAG A/AA and best practices). No new violations.
aria-dialog-nameandscrollable-region-focusableon the open popover already fail on main, and this diff doesn't touch the popover.Doc check. No docs describe filter label truncation, so no docs changes are needed.
🤖 Generated by Coder Agents on behalf of @chrifro. Review fixes by Coder Agents on behalf of @jeremyruppel.