-
Notifications
You must be signed in to change notification settings - Fork 0
π¨ Palette: Add aria-labels and focus states to close icons #112
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -568,7 +568,7 @@ export const Dashboard: React.FC = () => { | |||||
| <button onClick={() => setCatchUpPlan('CATCH_UP', missedDaysCount)} className="flex-1 sm:flex-none px-4 py-2 bg-amber-500 hover:bg-amber-400 text-amber-950 font-bold text-sm rounded-lg shadow-[0_0_15px_rgba(245,158,11,0.3)] transition-all flex items-center justify-center gap-2"> | ||||||
| <Zap size={16} /> Catch Up Faster | ||||||
| </button> | ||||||
| <button onClick={dismissCatchUpBanner} className="px-2 py-2 text-zinc-500 hover:text-zinc-300 rounded-lg hover:bg-zinc-800/50 transition-colors"><X size={18} /></button> | ||||||
| <button aria-label="Dismiss catch-up banner" onClick={dismissCatchUpBanner} className="px-2 py-2 text-zinc-500 hover:text-zinc-300 rounded-lg hover:bg-zinc-800/50 transition-colors focus-visible:ring-2 focus-visible:ring-emerald-500 outline-none"><X size={18} /></button> | ||||||
|
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. Consider using In Tailwind CSS v4, π¨ Proposed fix to use outline-hidden- <button aria-label="Dismiss catch-up banner" onClick={dismissCatchUpBanner} className="px-2 py-2 text-zinc-500 hover:text-zinc-300 rounded-lg hover:bg-zinc-800/50 transition-colors focus-visible:ring-2 focus-visible:ring-emerald-500 outline-none"><X size={18} /></button>
+ <button aria-label="Dismiss catch-up banner" onClick={dismissCatchUpBanner} className="px-2 py-2 text-zinc-500 hover:text-zinc-300 rounded-lg hover:bg-zinc-800/50 transition-colors focus-visible:ring-2 focus-visible:ring-emerald-500 outline-hidden"><X size={18} /></button>As per coding guidelines, this aligns with Tailwind CSS v4 best practices for custom focus indicators. π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||
| </div> | ||||||
| </div> | ||||||
| </div> | ||||||
|
|
||||||
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.
π§© Analysis chain
π Web query:
Tailwind CSS v4 outline-none vs outline-hidden behavior differenceπ‘ Result:
In Tailwind CSS v4, the
outline-noneandoutline-hiddenutilities serve distinct purposes regarding how they handle browser focus indicators, especially concerning accessibility and forced colors mode [1][2]. outline-none The v4outline-noneutility is a simple, standard wrapper that setsoutline-style: none[1][3]. It is intended for use when you want to completely remove the browser's default focus outline, typically because you are implementing your own custom focus ring [1][4]. Because this utility strictly removes the outline, it does not provide any accessibility fallbacks for forced colors mode [1][2]. outline-hidden Theoutline-hiddenutility is the direct replacement for the behavior ofoutline-nonein Tailwind CSS v3 [2]. It is designed to be the preferred choice for accessibility [4][2]. While it setsoutline-style: nonein standard environments, it preserves an invisible focus indicator (specifically a 2px solid transparent outline) when the browser is in forced colors mode [1][3][2]. This ensures that users relying on high-contrast or forced-color themes can still perceive when an element has received focus, maintaining accessibility standards [1]. Summary Table Utility | Behavior | Use Case --- | --- | --- outline-none | Setsoutline-style: none| Use when replacing the default focus ring with a custom implementation. outline-hidden | Setsoutline-style: none(standard); preserves outline (forced colors) | Use for general accessibility to maintain focus visibility in high-contrast modes. If you are migrating from v3 to v4, Tailwind Labs recommends replacing all instances ofoutline-nonewithoutline-hiddenunless you specifically require the behavior of the new, simplifiedoutline-none[2].Citations:
outline-nonewithoutline-hidden, add newoutline-noneΒ tailwindlabs/tailwindcss#14926Use
outline-hiddeninstead ofoutline-nonefor the custom focus ringIn
src/components/Analytics.tsx(lines 916-918), switchoutline-nonetooutline-hiddenso focus remains visible in forced-colors/high-contrast modes even though youβre adding your ownfocus-visible:ring-*ring.π¨ Proposed fix
<button aria-label="Close session details" onClick={() => setViewingSession(null)} - className="w-10 h-10 flex items-center justify-center rounded-full hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 transition-colors focus-visible:ring-2 focus-visible:ring-emerald-500 outline-none" + className="w-10 h-10 flex items-center justify-center rounded-full hover:bg-zinc-800 text-zinc-400 hover:text-zinc-100 transition-colors focus-visible:ring-2 focus-visible:ring-emerald-500 outline-hidden" >π Committable suggestion
π€ Prompt for AI Agents