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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When using a link as a button with the aria role we need to handle the spacebar as this can be used for buttons but will scroll the page when used on non-native buttons
// Simply adding an eventlistener for the keypress event (which is what triggers the scroll) is not sufficient
// Native buttons allow a use to press the spacebar and then cancel it with the tab key
// So we need to listen for two events:
// 1. the keypress to cancel the scroll
// 2. the keyup to check the press has not been cancelled by a tabkey press - only this event results in a click being triggered