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

Exit this Page shortcut is sometimes aborted when combining Left Shift and Right Shift #5393

Open
querkmachine opened this issue Oct 10, 2024 · 0 comments
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) exit this page javascript

Comments

@querkmachine
Copy link
Member

querkmachine commented Oct 10, 2024

Description of the issue

The Exit this Page shortcut is intended to be agnostic towards whether the user uses the Left Shift key or Right Shift key, so long as the user presses one of them three times.

However, it can misfire and abort the shortcut activation if the user mixes use of both keys. Rapidly alternating Left Shift and Right Shift keys can sometimes cause both to be registered as pressed at the same time. This triggers the lastKeyWasModified check, which is intended to avoid accidental activation when using the Shift key for regular typing, and thus aborts the shortcut.

This is very edge case-y, but it is something we can probably rectify in code.

Steps to reproduce the issue

  1. Open a page with Exit this Page functionality (e.g. the Design System website example)
  2. Press Left and Right Shift simultaneously. Alternatively, rapidly alternate pressing Left Shift and Right Shift.

Actual vs expected behaviour

Actual

The indicator light will briefly flicker on before disappearing, the shortcut having been aborted.

Expected

The shortcut will not be aborted as the user has only pressed shift keys.

Environment (where applicable)

Reproduced in the below, but likely applies to all browsers and operating systems that run the EtP JavaScript.

  • Operating system: macOS 14.7
  • Browser: Chrome
  • Browser version: 129
  • GOV.UK Frontend Version: 5.6.0
@querkmachine querkmachine added 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) javascript exit this page labels Oct 10, 2024
@querkmachine querkmachine changed the title Exit this Page shortcut doesn't work when mixing Left Shift and Right Shift Exit this Page shortcut is sometimes aborted when combining Left Shift and Right Shift Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) exit this page javascript
Projects
None yet
Development

No branches or pull requests

1 participant