-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: Improve Staff Access Modal UX & Accessibility #38
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ## 2025-05-15 - Staff Access Accessibility & UX | ||
| **Learning:** Adding `aria-haspopup="dialog"` and `role="button"` to triggers for modal dialogs is essential for screen readers to properly announce the interaction. Focus management (auto-focusing the first input) and keyboard support (Enter key) are critical for power users and those with motor impairments. | ||
| **Action:** Always ensure modal triggers have appropriate ARIA roles and that modals implement focus management and keyboard listeners for common actions. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -230,7 +230,19 @@ class TryOnYouBunker { | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| requestPrivatePass() { | ||||||||||||||||||||||||||||||||||||||
| const modal = document.getElementById('private-pass-modal'); | ||||||||||||||||||||||||||||||||||||||
| const input = document.getElementById('private-pass-input'); | ||||||||||||||||||||||||||||||||||||||
| modal.style.display = 'flex'; | ||||||||||||||||||||||||||||||||||||||
| input.focus(); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if (!this._passListener) { | ||||||||||||||||||||||||||||||||||||||
| input.addEventListener('keydown', (e) => { | ||||||||||||||||||||||||||||||||||||||
| if (e.key === 'Enter') { | ||||||||||||||||||||||||||||||||||||||
| e.preventDefault(); | ||||||||||||||||||||||||||||||||||||||
| this.verifyPrivatePass(); | ||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function call leads to All authentication and authorization checks must be performed on the server-side. The client should send the password to a secure backend endpoint for verification. |
||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||
| this._passListener = true; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+237
to
+245
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To improve code clarity, it's better to use a more descriptive name for the flag that tracks if the event listener has been added. For better maintainability and to prevent potential memory leaks, it's a best practice to add event listeners when they are needed and remove them when they are not (e.g., in
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| closePrivatePass() { | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better accessibility and semantics, it's recommended to use a
<button>element for actions instead of an<a>tag withrole="button". A native<button>is keyboard-accessible by default (handling both Enter and Space keys) and is the correct semantic element for triggering an action like opening a modal.You will need to apply styling to the button to make it visually consistent with the other navigation links. Using a class like
nav-buttoncan help with this.