-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: [UX improvement] Enhance Keyboard Accessibility and ARIA Support #31
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 - Accessible Custom Interactive Elements | ||
| **Learning:** For custom interactive elements (e.g., `div` as a product item), adding `role="button"` and `tabindex="0"` is only half the battle. To ensure full keyboard operability, explicit listeners for both 'Enter' and 'Space' must be implemented in JavaScript to mirror native button behavior. | ||
| **Action:** Always pair `tabindex="0"` on non-interactive elements with a `keydown` handler that triggers the primary action on 'Enter' and 'Space'. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,11 @@ body { | |
| color: var(--accent-gold); | ||
| } | ||
|
|
||
| .nav-menu a:focus-visible { | ||
| outline: 2px solid var(--accent-gold); | ||
| outline-offset: 4px; | ||
| } | ||
|
Comment on lines
+85
to
+88
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 maintainability and reduce code duplication, consider grouping all the new You could define a single rule like this in a shared/global styles section and remove the other individual declarations: .nav-menu a:focus-visible,
.cta-button:focus-visible,
.camera-btn:focus-visible,
.product-item:focus-visible {
outline: 2px solid var(--accent-gold);
outline-offset: 4px;
}This makes it easier to update the focus style consistently across the application in the future. |
||
|
|
||
| /* Hero Section */ | ||
| .hero { | ||
| height: 100vh; | ||
|
|
@@ -131,6 +136,11 @@ body { | |
| box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4); | ||
| } | ||
|
|
||
| .cta-button:focus-visible { | ||
| outline: 2px solid var(--accent-gold); | ||
| outline-offset: 4px; | ||
| } | ||
|
|
||
| /* Features Section */ | ||
| .features { | ||
| padding: 120px 0; | ||
|
|
@@ -247,6 +257,11 @@ body { | |
| color: var(--bg-dark); | ||
| } | ||
|
|
||
| .camera-btn:focus-visible { | ||
| outline: 2px solid var(--accent-gold); | ||
| outline-offset: 4px; | ||
| } | ||
|
|
||
| .product-selector h3 { | ||
| margin-bottom: 2rem; | ||
| color: var(--accent-gold); | ||
|
|
@@ -273,6 +288,11 @@ body { | |
| border-color: var(--accent-gold); | ||
| } | ||
|
|
||
| .product-item:focus-visible { | ||
| outline: 2px solid var(--accent-gold); | ||
| outline-offset: 4px; | ||
| } | ||
|
|
||
| .product-placeholder { | ||
| height: 180px; | ||
| display: flex; | ||
|
|
||
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 code clarity and to avoid dispatching a synthetic event, it's better to call the
this.selectGarment()method directly instead of programmatically triggering a click. This makes the code's intent clearer, avoids the overhead of the event system, and removes the dependency on theclickevent handler.