You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the same way that a click is triggered for anchors on keyboard selection, I would expect the same to apply for buttons as well. However that is not the case. Instead, you have to handle the close-menu event manually to produce the same effect.
Compare between using mouse and keyboard to select from two kinds of menu: Example Playground
Also notice how anchors only get clicked on Enter but not Space which matches their native behavior but not so much the menu spec. The inconsistency irks me a bit but meh. As an aside, I feel like handling selection from a menu is the most essential part of using it so there should be an easier way to go about all this.
The text was updated successfully, but these errors were encountered:
The initial reasoning is that a click will cause the menu to close / open submenu via click selection. This would then likely trigger the close twice and cause some visual jank.
Additionally, by marking it as defaultPrevented == true, we prevent the menu's typeahead functionality from triggering on "space" as the first button pressed.
We might be able to add some likely non-trivial logic / rewrite here to solve this. Perhaps another marker other that preventDefault, but that may degrade the DX of "just call preventDefault on any event to opt out of menu events"
Description
In the same way that a click is triggered for anchors on keyboard selection, I would expect the same to apply for buttons as well. However that is not the case. Instead, you have to handle the close-menu event manually to produce the same effect.
Compare between using mouse and keyboard to select from two kinds of menu:
Example Playground
Also notice how anchors only get clicked on Enter but not Space which matches their native behavior but not so much the menu spec. The inconsistency irks me a bit but meh. As an aside, I feel like handling selection from a menu is the most essential part of using it so there should be an easier way to go about all this.
The text was updated successfully, but these errors were encountered: