Skip to content
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

fix: select fixes and cleanup #614

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

ashley-hunter
Copy link
Collaborator

@ashley-hunter ashley-hunter commented Feb 23, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Which package are you modifying?

  • accordion
  • alert
  • alert-dialog
  • aspect-ratio
  • avatar
  • badge
  • button
  • calendar
  • card
  • checkbox
  • collapsible
  • combobox
  • command
  • context-menu
  • data-table
  • date-picker
  • dialog
  • dropdown-menu
  • hover-card
  • icon
  • input
  • label
  • menubar
  • navigation-menu
  • pagination
  • popover
  • progress
  • radio-group
  • scroll-area
  • select
  • separator
  • sheet
  • skeleton
  • slider
  • sonner
  • spinner
  • switch
  • table
  • tabs
  • textarea
  • toast
  • toggle
  • tooltip
  • typography

What is the current behavior?

Closes #453, #551

What is the new behavior?

I have reworked the select component, previously we have 3 sources of truth, the user state, the select service state and the CDK listbox directives state. Keeping this all in sync is a bit of a nightmare, and while utilizing the cdk usually reduces the amount of code required, in the case it actually increased it by quite a lot, since we don't actually use much of the functionality it provides. This PR refactors the component, simplifying it greatly and allowing us to avoid the bugs that previously existed due to this inconsistent state.

I have also added support for custom value and placeholder templates.

Does this PR introduce a breaking change?

  • Yes
  • No

There are two minor breaking changes in this PR, the first is I have renamed openedChange, to openChange, this allows us to two way bind the property, and follows the typical naming convention.

The second is the switch from focusing each option to using active descendant. Active descendant is much simpler than changing tab indexes and ensuring that the if the focused item is removed that everything is updated correctly. This is how libraries like Material handle keyboard navigation in select components. The only real breaking changing is the focus styling class in helm option needs slightly changed.

Both of these breaking changes have migrations and health check to automatically migrate them.

Other information

@thatsamsonkid
Copy link
Collaborator

Love the change, yea I think at initial concept leveraging CDK Listbox seemed like a good idea but it ultimately didn't work to well in the end. Im excited for this!

@ashley-hunter ashley-hunter marked this pull request as ready for review February 24, 2025 22:48
@ashley-hunter
Copy link
Collaborator Author

Love the change, yea I think at initial concept leveraging CDK Listbox seemed like a good idea but it ultimately didn't work to well in the end. Im excited for this!

Thank you! The changes I believe should now be complete, if I have missed anything let me know 😀 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Select - Compare with and customizable select value to allow for object values
2 participants