-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add frozen value to ComboboxOptions
component
#3126
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
RobinMalfait
changed the title
Keep visual state on old
Add frozen value to Apr 24, 2024
ComboboxOption
when selecting new valueComboboxOption
component
RobinMalfait
force-pushed
the
feat/add-frozen-value-to-combobox
branch
from
April 24, 2024 14:19
99e2dc5
to
0525c53
Compare
RobinMalfait
force-pushed
the
feat/portal-prop
branch
from
April 24, 2024 14:38
e1aac1c
to
bf7497e
Compare
Once you choose an option, the `selected` state remains on the "old" value until the combobox is fully closed. This way the potential visual indicators such as a check mark doesn't move around while the Combobox is closing (when using transitions) Same as the `Listbox`, this is purely about visual state and exposed data from the `ComboboxOptions` component and down that tree. The top-level `Combobox` and `ComboboxInput` components still know the correct (new) value and will update the `aria-activedescendant` correctly. This is achieved by storing the old data (only in single value mode), and overriding the `isSelected` check function via context provided by the `ComboboxOptions` component.
But now with this change, it will be present.
RobinMalfait
force-pushed
the
feat/add-frozen-value-to-combobox
branch
from
April 24, 2024 15:11
0525c53
to
30c6d5a
Compare
thecrypticace
approved these changes
Apr 24, 2024
RobinMalfait
changed the title
Add frozen value to
Add frozen value to Apr 24, 2024
ComboboxOption
componentComboboxOptions
component
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces a frozen value, similar to the
Listbox
component. This allows us to keep the visual state of the "old" value when selecting a new value.The reason for this is that when you select a value, the combobox will close and in a lot of cases a (fade out) transition is happening. If we change the selected state to the new value, then the UI will flicker (or at least changes visual state) when the transition is happening. This PR prevents that. This is also how the native
<select>
works.Note: the
Combobox
andComboboxInput
still know about the correct newly selected value and will updatearia-activedescendant
information correctly.Also note that this only happens in "single value mode", if you use the
multiple
prop, then the selected value will be updated immediately.