fundamental-ngx
fundamental-ngx copied to clipboard
Button keydown event trigger with spacebar
Is this a bug, enhancement, or feature request?
Bug
Briefly describe your proposal.
I am currently using a normal button with fdpMenuTriggerFor.
<button fd-button [fdpMenuTriggerFor]="basicMenu" label="Button example"></button>
The problem is when the focus is on the button and I am holding the spacebar, the event keeps on triggering which is leading to a flickering of menuItems (closing and opening the menu recursively).
Which versions of Angular and Fundamental Library for Angular are affected? (If this is a feature request, use current version.)
Angular version - 13 ngx - 0.33.4
If this is a bug, please provide steps for reproducing it.
Focus on the button (Button example) and hold space - Observe the flickering of menu items
https://sap.github.io/fundamental-ngx/#/platform/menu
Is there anything else we should know?
ngx core menu seems to be working fine with fdMenuTrigger as the event is not getting triggered again and again. I think ismenuOpened check is missing in the platform.
https://sap.github.io/fundamental-ngx/#/core/menu
Hello @prasad-userdev, thank you for using fundamental-ngx! The fundamental-ngx team will triage your issue as soon as possible.
I think this is simply the way the fdp-menu works differently from the fd-menu - it is a bit more opinionated - clicking an item with the core (fd) menu doesn't do anything automatically whereas the platform (fdp) menu fires the itemSelect event, closes the menu, and refocuses the menu trigger button. So holding space will simply open the menu, automatically focus the first item, selects it, close the menu while focusing the trigger button, and the cycle repeats. I think this can be considered the intended behavior and I would recommend using the fd-menu as an alternative if you need to work around this behavior
Thanks for the reply @mikerodonnell89 Changing it to fd-menu would be our last option as Its been used across the application
According to me, It will run in a loop until the user releases the key which would not be the expectation from the end user/blind users.
Also, If the span/div with role "button" was used then I agree on your point. But here we are using a default button. So the expectation for this would be - single event trigger until any key (space/enter) pressed is released.