Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE#1881][MAS2.1.2][Keyboard Navigation- Welcome Tab screen] Focus gets trapped on first and last element of the page when user navigates through the page #2001

Merged
merged 16 commits into from Nov 26, 2019

Conversation

@denscollo
Copy link
Collaborator

denscollo commented Nov 21, 2019

Solves #1881

Description

Fixes how the focus gets trapped between the last and the first element of the pane.

Changes made

We added a new condition to the EventHandlers class which will manage the focus when the emulator is running in macOS. Also, we included two auxiliary methods to find the first and last elements of the active pane and be able to move the focus between them.

Additionally, we added two unit tests to cover the new keydown event.

Testing

In the following image, you can see how the focus goes from the last element of the pane to the first when navigating with Tab key and vice-versa when using Shift+Tab navigation:

FocusTrap

@coveralls

This comment has been minimized.

Copy link

coveralls commented Nov 21, 2019

Coverage Status

Coverage increased (+0.08%) to 68.75% when pulling 50b4d5c on fix/focus-trap-in-mac-navigation into cb08d7d on master.

CHANGELOG.md Outdated Show resolved Hide resolved
denscollo and others added 3 commits Nov 22, 2019
Copy link
Member

corinagum left a comment

Thanks for the help! Just a couple of small changes.

denscollo added 2 commits Nov 26, 2019
@denscollo

This comment has been minimized.

Copy link
Collaborator Author

denscollo commented Nov 26, 2019

@corinagum if we move lines 142 & 143 to the ones that you told us, the isFirstElement and isLastElement variables are not going to work. If you want us to move those line, we need to update the if clause to be something like:
if (shiftPressed && document.activeElement === document.querySelector('nav').firstElementChild as HTMLElement) { }

And something similar would happen to the other if clause, since it uses lastDecendants to obtain the lastElement.

Let us know if you want us to proceed with this change.

@corinagum corinagum merged commit 2d88a90 into master Nov 26, 2019
2 checks passed
2 checks passed
Emulator-CI-PR #92501 succeeded
Details
license/cla All CLA requirements met.
Details
@tonyanziano tonyanziano deleted the fix/focus-trap-in-mac-navigation branch Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.