-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
[Package] Components/packages/components/packages/components[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Description
Context
Continuing with the exploration started by @ciampo in #41466, this issue will track the migration of CustomSelectControl to Ariakit.
Legacy: #55234
New version: #55790
Initial steps
- Analyze the legacy component, learn how it works, take note of its features
- Study Ariakit's Select component
- Look into ARIA roles
- Consider using WordPressComponentsProps
CustomSelect: AddWordPressComponentsProps#56998 - Create a new, temporary component which should implement:
-
children(and a CustomSelectControlV2.Item component) to allow its consumers to specify select options - basic functionality (
value/onChange/defaultValue/label/sizeprops) - styles that match the legacy component
- Storybook docs and examples (maybe one with post authors)
-
- Refine README, types stories, etc CustomSelect: Adapt component for legacy props #57902
V2 Legacy Wrapper
Completed in #57902
- Analyze the "API gap" between the legacy and the new component
- Come up with a strategy on how to bridge the gap
- Add support for the "monolithic" usage of the component with the options prop
- Bolster the legacy CustomSelectControl unit tests
CustomSelectControl: add additional unit tests #56575 - Use the previously bolstered unit tests to certify that the new component behaves like the legacy one
- Align unit tests CustomSelectControl: align v1 and legacy v2 unit tests #62706
- Fix option extra attributes types and propagation to
onChangecallback and DOM elementsCustomSelectControlV2: fix handling of extra attributes passed tooptionsin the legacy adapter #62255 - Investigate potential issues when using v2 legacy adapter in controlled mode, as the component doesn't seem to update correctly when a new
valueis passed? (can be reproduced by following the testing instructions inCustomSelectControlV2: fix handling of extra attributes passed tooptionsin the legacy adapter #62255 re.FontAppearanceControlin global styles) — fix in CustomSelectControl V2: fix setting initial value and reacting to external controlled updates #62733 - Double check initial item selection, including the fact that
onChangedoesn't fire on first render on v1 while it does on legacy v2 (WIP PRCustomSelectControlV2: Fix initial value not being set in the select for the V1 legacy adapter #62308, comment) — fix in CustomSelectControl V2: fix setting initial value and reacting to external controlled updates #62733 - Double check any styling issues as flagged in this comment and following conversation (plus check WIP in
CustomSelectControlV2: Fix styling issues #62424)- CustomSelectControlV2: fix popover styles #62821
- CustomSelectControlV2: Handle long strings in selected value #62198
- CustomSelectControlV2: Add root element wrapper #62803
- CustomSelectControl V2: allow wrapping item hint to new line #62848
- CustomSelectControlV2: fix select popover content overflow #62844
- CustomSelectControlV2: tweak item inline padding based on size #62850
- CustomSelectControlV2: fix item styles #62825
- CustomSelectControl V2: fix trigger text alignment in RTL languages #62869
- CustomSelectControl V2 legacy adapter: fix trigger button font size #63131
- CustomSelectControlV2: collapse checkmark space when unchecked #63229
- CustomSelectControlV2: keep item checkmark top aligned #63230
- Align keyboard event propagation while focussing select popover (context) CustomSelectControl V2: prevent keyboard event propagation in legacy wrapper #62907
- Check arrow down behaviour CustomSelectControl V2: keep legacy arrow down behavior only for legacy wrapper #62919
- CustomSelectControl V2: fix labelling with a visually hidden label #63137
- Make the V2 legacy wrapper available via private APIs CustomSelectControlV2: expose legacy wrapper through private APIs #62936
- Swap all V1 usages with V2 legacy wrapper (remember to also check and possibly remove unnecessary style overrides)
- FontSizePicker: use CustomSelectControl V2 legacy adapter #63134
- Block position controls: use V2 legacy adapter instead of V1
CustomSelectControl#63139 - DateFormatPicker: use CustomSelectControl V2 legacy adapter #63171
- FontAppearanceControl: use CustomSelectControl V2 legacy adapter #63179
- SpacingInputControl: use CustomSelectControl V2 legacy adapter #63190
- Check that there are no unknown style overrides remaining
- CustomSelectControlV2: do not flip popover if legacy adapter #63357
- CustomSelectControl V2 legacy adapter: stabilize experimental props #63248
- CustomSelectControlV2: animate select popover appearance #63343
- CustomSelectControl: switch to ariakit-based implementation #63258
- Prepare dev note
V2
To discuss
- Review API surface:
- Based on how much we expect V2 default to diverge from V2 legacy wrapper, does it make sense to keep a common underlying implementation, since it comes at the cost of higher complexity in the internal implementation
- if so, let's see if there is a better way to allow different behavior / styles between the two versions (we currently use React context + passing props to Styled components)
- Should the components forward refs? If so, should they expose multiple refs? (ie. to the label, the button, and the popover)
- How to differentiate between props for wrapper vs props for trigger? Should we have a trigger render prop, like we do for
DropdownMenuV2? (see CustomSelectControlV2: Add root element wrapper #62803 (comment)))
- Based on how much we expect V2 default to diverge from V2 legacy wrapper, does it make sense to keep a common underlying implementation, since it comes at the cost of higher complexity in the internal implementation
- Popover behavior and APIS:
- Should the popover be modal ? Regardless, should it always prevent body scroll?
- Where should the popover render in the DOM ? Always inline? Always portal-ed ? If so, in which slot (see Popover-based UI: do not render in Popover.Slot by default #56482)? Should we expose any props?
- This should influence / should be influenced by
DropdownMenuV2too
- This should influence / should be influenced by
- Consider cloning + splitting V1 and V2 implementations, so that V2 can diverge without affecting V1
- Do we need an
isMultipleprop? (especially when neithervaluenordefaultValueare specified, but also for TS ergonomics) - Discuss whether it makes sense to tweak the size of each item based on the pointer type (smaller items for fine pointer control, larger items for coarser pointer)
- Discuss best approach to the select popover
height(including the maximum and minimum heights) (see Improve CustomSelectControl's usability around max height #49110) - Discuss best approach to the select popover flip behavior (especially in the light of CustomSelectControl V2 popover renders below position: sticky elements #63180)
- Consider adding new features (like exporting more subcomponents, separators, group and group labels, etc)
- Including new
Select-related components recently added to Ariakit
- Including new
- Ask design for specs/review
- Should it have more specific prefix/suffix structure, similarly to the new
DropdownMenuItem? - Checkmark/
SelectItemCheck- should it be optional?
- should it be instead exported as a subcomponent, and used by consumers when needed?
- placement:
Should the design for CustomSelectItem be inspired by the work? Specifically; placing the checkmark icon on the left?
- review line height (see comment)
- Should it have more specific prefix/suffix structure, similarly to the new
To implement
- Remove legacy adapter layer (make two separate exports) CustomSelectControlV2: Remove legacy adapter layer #59420
- Rename to
CustomSelectControlandCustomSelectControl.ItemCustomSelectControlV2: Rename for consistency #60178 - Should the list of items always have the same width as the closed component? CustomSelect: Adapt component for legacy props #57902
- Add compact size CustomSelect: Adapt component for legacy props #57902
- Focus / hover styles on both the items and the selected value CustomSelectControlV2: Use
InputBasefor styling #60261 - Try to make the TS types for the single/multiple selection modes be more ergonomic
- Update ariakit to latest version and see new
Selectcomponents (see changelog) - See what unit tests can be applied also to the v2 implementation (non legacy)
- Needs a utility padding wrapper like
InputControlPrefixWrapper - Allowing the trigger button to be
disabled - Improve CustomSelectControl's usability around max height #49110
- CustomSelectControl V2 popover renders below position: sticky elements #63180
To check before releasing
- Public-facing docs (Types, Storybook examples, READMEs)
- Export the component as private API, start experimenting in the editor
- Check with accessibility folks on this and for overall feedback
Mamaduka and ciampo
Metadata
Metadata
Labels
[Package] Components/packages/components/packages/components[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Type
Projects
Status
In progress (owned) ⏳