Skip to content

🎨 Palette: Improve Staff Access Modal UX & Accessibility#38

Open
LVT-ENG wants to merge 1 commit intomainfrom
palette-staff-modal-ux-7288896619108026548
Open

🎨 Palette: Improve Staff Access Modal UX & Accessibility#38
LVT-ENG wants to merge 1 commit intomainfrom
palette-staff-modal-ux-7288896619108026548

Conversation

@LVT-ENG
Copy link
Copy Markdown
Member

@LVT-ENG LVT-ENG commented Mar 27, 2026

💡 What: Added accessibility attributes (aria-haspopup, role="button", aria-label), implemented auto-focus, and added "Enter" key support for password submission in the Staff Access modal.
🎯 Why: To make the staff login flow more intuitive, accessible for screen readers, and faster for keyboard-centric users.
♿ Accessibility: Improved screen reader identification of the modal trigger and input field.
📸 Before/After: Visual confirmation via Playwright shows the modal opening with the input automatically focused and ready for keyboard input.


PR created automatically by Jules for task 7288896619108026548 started by @LVT-ENG

- Add aria-haspopup="dialog" and role="button" to Staff Access link
- Add aria-label to private-pass-input
- Implement auto-focus and Enter-key submission in js/main.js

Co-authored-by: LVT-ENG <214667862+LVT-ENG@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
_deploy_build Ready Ready Preview, Comment Mar 27, 2026 5:47am
tryonyou-org Ready Ready Preview, Comment Mar 27, 2026 5:47am

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the accessibility and user experience of the 'Staff Access' modal by implementing ARIA roles, focus management, and keyboard support. The review identifies a critical security vulnerability involving client-side password validation and provides suggestions for improving HTML semantics by using button elements and refining JavaScript event listener management.

input.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.verifyPrivatePass();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

This function call leads to verifyPrivatePass, which performs password validation on the client-side with a hardcoded password ("SAC_MUSEUM_2026"). This is a critical security vulnerability. Anyone can view the page's JavaScript source to find the password and bypass this protection.

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.

<li><a href="#try-on">Búnker</a></li>
<li><a href="#consultation">P.A.U.</a></li>
<li><a href="javascript:void(0)" onclick="requestPrivatePass()">Staff Access</a></li>
<li><a href="javascript:void(0)" onclick="requestPrivatePass()" aria-haspopup="dialog" role="button">Staff Access</a></li>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better accessibility and semantics, it's recommended to use a <button> element for actions instead of an <a> tag with role="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-button can help with this.

Suggested change
<li><a href="javascript:void(0)" onclick="requestPrivatePass()" aria-haspopup="dialog" role="button">Staff Access</a></li>
<li><button type="button" class="nav-button" onclick="requestPrivatePass()" aria-haspopup="dialog">Staff Access</button></li>

Comment on lines +237 to +245
if (!this._passListener) {
input.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.verifyPrivatePass();
}
});
this._passListener = true;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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. _passListener is ambiguous; it could be a boolean or the listener function itself. A name like _isPassKeyListenerAttached would be more explicit.

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 closePrivatePass()). While the current implementation works, attaching an event listener that is never removed is not ideal in long-running applications.

Suggested change
if (!this._passListener) {
input.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.verifyPrivatePass();
}
});
this._passListener = true;
}
if (!this._isPassKeyListenerAttached) {
input.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.verifyPrivatePass();
}
});
this._isPassKeyListenerAttached = true;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant