fundamental-ngx icon indicating copy to clipboard operation
fundamental-ngx copied to clipboard

Button keydown event trigger with spacebar

Open prasad-userdev opened this issue 2 years ago • 3 comments

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/menuimage

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 image

prasad-userdev avatar Jun 10 '22 11:06 prasad-userdev

Hello @prasad-userdev, thank you for using fundamental-ngx! The fundamental-ngx team will triage your issue as soon as possible.

github-actions[bot] avatar Jun 10 '22 11:06 github-actions[bot]

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

mikerodonnell89 avatar Jun 22 '22 21:06 mikerodonnell89

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.

prasad-userdev avatar Jun 23 '22 03:06 prasad-userdev