UI: Migrate Select from Popper.js tooltip to react-aria overlay#32393
Conversation
|
View your CI Pipeline Execution ↗ for commit 7b31b8c
☁️ Nx Cloud last updated this comment at |
ee2c22d to
b0fa742
Compare
ghengeveld
left a comment
There was a problem hiding this comment.
Not sure why CI didn't run. Code looks good, but I'd like to see how the Chromatic snapshots turn out. @MichaelArestad should probably take this for a spin as well.
a44079b to
8eb0e22
Compare
I was hoping you wouldn't review this one so quickly, it's based on the IconButton/Select branch and I hadn't finished fixing all the E2E and unit tests on that. It should be green soon enough :) |
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 48 | 48 | 0 |
| Self size | 30.78 MB | 32.57 MB | 🚨 +1.79 MB 🚨 |
| Dependency size | 17.61 MB | 17.61 MB | 0 B |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 204 | 204 | 0 |
| Self size | 879 KB | 879 KB | 0 B |
| Dependency size | 81.74 MB | 83.53 MB | 🚨 +1.79 MB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 173 | 173 | 0 |
| Self size | 35 KB | 35 KB | 🚨 +42 B 🚨 |
| Dependency size | 76.81 MB | 78.60 MB | 🚨 +1.79 MB 🚨 |
| Bundle Size Analyzer | Link | Link |
create-storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 49 | 49 | 0 |
| Self size | 1.52 MB | 1.52 MB | 0 B |
| Dependency size | 48.39 MB | 50.18 MB | 🚨 +1.79 MB 🚨 |
| Bundle Size Analyzer | node | node |
268805e to
3a794d4
Compare
eee554c to
1e18255
Compare
1e18255 to
7b31b8c
Compare
Caution
Must base onto next once the IconButton branch is merged!⚠️ ⚠️ ⚠️
What I did
This PR is part of the work done on WithTooltip replacement. It specifically addresses Select's use of WithTooltip.
Select's menu is not a tooltip, it's an interactive popover with a listbox role. We already have KB nav and aria markup working, all we were missing was:
The PR uses low-level react-aria hooks to achieve this.
The miminalist popover inside
Select.tsxwill likely not be reusable. We have higher-level primitives for most use cases, but here I needed something very low-level to keep the existing KB nav logic in place.Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Documentation
N/A
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>Greptile Summary
Updated On: 2025-09-03 17:34:52 UTC
This PR migrates the Select component from using
WithTooltipPure(based on Popper.js) to react-aria overlay hooks for better semantic correctness and accessibility. The Select component's dropdown menu was previously implemented as a tooltip, but semantically it should be an interactive popover with a listbox role.The main changes include:
New dependency: Adds
react-aria-components@^1.12.1to the core package to access overlay positioning and interaction hooksCustom MinimalistPopover component: Replaces
WithTooltipPurewith a new component that uses three react-aria hooks:useOverlayPositionfor popover placement without Popper.jsuseInteractOutsidefor handling clicks outside the popoveruseOverlayfor focus management and dismissal behaviorImproved ARIA semantics: Updates role assignments so single-select uses
buttonrole and multi-select usescomboboxrole, following proper accessibility guidelinesEnhanced keyboard navigation: Maintains existing keyboard shortcuts while adding Tab key handling to close the popover
Visual consistency: Adds
borderRadius: 2to focused select options for consistent stylingThe migration preserves all existing functionality including complex multi-select logic, keyboard navigation, and ARIA markup while moving to a more semantically correct and accessible implementation. The new MinimalistPopover is intentionally low-level and non-reusable to maintain the existing keyboard navigation behavior.
Confidence score: 4/5