sparksuite / react-accessible-dropdown-menu-hook

A simple Hook for creating fully accessible dropdown menus in React
http://sparksuite.github.io/react-accessible-dropdown-menu-hook
MIT License
112 stars 26 forks source link

Allow to use any HTML Element as menu item #325

Open jirutka opened 1 month ago

jirutka commented 1 month ago

The code works with any HTML element, there's nothing that requires specifically HTMLAnchorElement (<a>) except e.currentTarget.href which is already conditional. Thus the current limitation is only a typing issue introduced by unnecessarily specific ref type. We can make it a generic parameter, but it wouldn't bring any real benefit, just increase complexity and decrease flexibility.

Resolves #174

jirutka commented 1 month ago

This PR would also need to update the itemProps definition in the docs on this page.

Done.