-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
chore(select): move ChangeHistory
to Dropdown
#7905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the ChangeHistory component by renaming and generalizing it into a new StatelessSelect component. The key changes are:
- The creation of a new StatelessSelect component to support generic selectable options.
- Moving the functionality from ChangeHistory into StatelessSelect.
- Removal of ChangeHistory and its associated stories and styles.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
packages/ui-components/Common/StatelessSelect/index.tsx | New generic select component with dropdown behavior. |
packages/ui-components/Common/StatelessSelect/index.stories.tsx | Storybook example updated for the new StatelessSelect component. |
packages/ui-components/Common/StatelessSelect/index.module.css | Removal of unused styles previously coupled with ChangeHistory. |
packages/ui-components/Common/ChangeHistory/index.tsx | Removal of obsolete ChangeHistory component code. |
packages/ui-components/Common/ChangeHistory/index.stories.tsx | Removal of obsolete ChangeHistory Storybook stories. |
Comments suppressed due to low confidence (1)
packages/ui-components/Common/StatelessSelect/index.tsx:10
- [nitpick] The prop name 'values' might be ambiguous for representing selectable options. Consider renaming it to 'options' to better reflect its purpose.
values: Array<HTMLProps<HTMLAnchorElement | HTMLDivElement>>;
Before merging, I'd like to get @canerakdas's approval |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #7905 +/- ##
==========================================
+ Coverage 75.30% 75.34% +0.03%
==========================================
Files 101 101
Lines 8326 8326
Branches 218 218
==========================================
+ Hits 6270 6273 +3
+ Misses 2054 2051 -3
Partials 2 2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move this under the Common/Select folder (even if as a sub-folder)
And then make a embed of the select on the current Select? So that when there's the main select hides and only the stateless remains?
Huh? I'm not sure I understand what you mean? |
The Select component or Dropdown one (idk what we call it) should embed both the JS-version of it and the Stateless version of it. So one renders on scenario and the one renders on script scenario. It could be as asimple as: <>
<Dropdown className=".regDrop-{generatedId}" ... />
<noscript>
<style>.regDrop-{generatedId} { display: none; }</style>
<StatelessDropdown ... />
</noscript>
</> |
The two components are structured differently. The stateful I’d prefer to go ahead with this as-is and then open an issue to explore a stateless version of Footnotes |
ChangeHistory
to Dropdown
ChangeHistory
to Dropdown
ChangeHistory
to Dropdown
Now that I think about it, we can probably replace some of our existing selects / implementations with this, since all they do is redirect, rather than function like a Select. |
Lighthouse Results
|
If JavaScript is available, I believe we should stick with the Radix primitive version for its accessibility features. While it's true that the props don’t fully align, the non-JavaScript fallback should still provide a functional alternative that enables users to perform basic navigation |
Understood. However, can that be a follow-up? I'd like for the generic component to land, and then someone to take on that as a separate task, since, to me, it seems vastly more complex, and I don't have the understanding of how this would work to investigate that complexity. |
Or, we could also draft this PR, and anyone on the team can push to it, like a feature branch |
Possibly then, we should refrain from replacing the JavaScript one for the not one atm. I don't think the benefit of "a non JavaScript select" versus removing all the current accessibility features is a worth trade-off. The amount of people without JS-enabled is far less than the amount of people that actually, hm... Need these accessibility sheets. |
Do we have progress here? |
I feel like generifying the ChangeHistory (this Pr) is good to land as is, and any potential select changes can be, as I mentioned, done in a follow-up? @ovflowd can you rescind your block? If you disagree, feel free to draft this. |
What accessibility features have been removed? I'm sure they can be re-added? |
Keyboard Selection as a starter. Radix has several a11y features built-in on their components. Hence why I believe either we just generify the Select in this PR and don't update the usages, or if we update the usages, then we gotta provide the default JS one and non-JS one as fallback, I think that is a good enough trade-off. |
I unfortunately don't feel comfortable landing as is; But if you then revert the changes that update Select's to sue the generic one, I'd be more than happy to remove the block. |
Description
Ref: #7794 (comment)
This moves
ChangeHistory
to a more genericDropdown
component.Validation
N/A
Related Issues
Check List
pnpm format
to ensure the code follows the style guide.pnpm test
to check if all tests are passing.pnpm build
to check if the website builds without errors.