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: align useCombobox getToggleButtonProps type with useSelect #1568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

drewbrend
Copy link
Contributor

@drewbrend drewbrend commented Jan 30, 2024

What:

Allow comboboxes to have a toggle button of any element type in TypeScript (not just an HTMLButtonElement)

Why:

useCombobox's getToggleButtonProps was only compatible with HTMLButtonElement

useSelect is compatible with any HTMLElement

This is related to my previous PR: #1486

I am now upgrading our repo to downshift V8 and noticed that this is fixed for selects, however comboboxes are still locked to using a button by this type.

How:

I simply changed HTMLButtonElement to HTMLElement to match select's behaviour.

I am not familiar enough with these types to say for sure, but it seems like we could simply align UseSelectGetToggleButtonPropsOptions with this UseComboboxGetToggleButtonPropsOptions? The only difference after this PR is that UseComboboxGetToggleButtonPropsOptions also has a disabled prop (through GetToggleButtonPropsOptions). Are implementations using useSelect able to disable the toggle button? If so, I think these could be simplified to use a shared type.

Checklist:

  • Documentation
  • Tests
  • TypeScript Types
  • Flow Types
  • Ready to be merged

useCombobox's getToggleButtonProps was only compatible with HTMLButtonElement

useSelect is compatible with any HTMLElement
@drewbrend drewbrend changed the title fix: align useCombobox getToggleButtonProps with useSelect fix: align useCombobox getToggleButtonProps type with useSelect Jan 30, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a5d6310) 100.00% compared to head (b21d159) 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1568   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines         1738      1738           
  Branches       522       522           
=========================================
  Hits          1738      1738           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

2 participants