Open ZarkoPernar opened 1 year ago
What's your use-case for faking a button with a div?
@james-nash nested buttons are one example but there are other cases where you have complex layouts in a clickable element, there the native button won't suffice.
Package name(s)
Core (@salt-ds/core)
Package version(s)
All
Description
It seems like useButton was primarily made to work for the native button html element. While making a div in to a button with useButton I encountered several issues that need to be addressed:
onClick
, instead ofonMouseDown
/onMouseUp
aria-disabled
is only applied when a disabled button is also focusableonKeyUp
does not triggeronClick
when the user presses enterSteps to reproduce
Expected behavior
aria-disabled
should be used insteadWe should add a feature flag, or an
elementType?: string
option to useButton like react-aria does in order to change some of the default behaviours like the disabled/aria-disabled. Others should be simply patched.Operating system
Browser
Are you a JPMorgan Chase & Co. employee?