reactioncommerce/example-storefront

Unable to navigate in EntryModal by keyboard

derBretti opened this issue · 0 comments

Type: minor

Description
In the 'Login' modal, only the first link is accessible by keyboard, since any KeyDown event triggers the underlying action and therefore the next element cannot be focused by using the tab key. The same logic prevents users in the 'SignUp' and 'ForgotPassword' modal from focusing a different element once they have focused one of the links there.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Sign In'
  2. Try to focus an element below 'Forgot Password?' by using the tab key
  3. The 'Forgot Password' modal is opened when the 'Forgot Password?' link is focused and the tab key is pressed

Expected behavior
All neccessary elements can be focused by using the tab key and activated by hitting enter.

Proposed solution
Check which key is pressed in the event handler function, e.g. instead of
onKeyDown={handleForgotPasswordClick}
use
onKeyDown={(e) => e.key === "Enter" && handleForgotPasswordClick()}