mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
fix: add keyboard accessibility and improve env var validation
Add focus-visible styles for keyboard navigation accessibility and improve PLAYWRIGHT_HEADLESS environment variable validation to warn users about invalid values instead of silently defaulting. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
10
client.py
10
client.py
@@ -50,9 +50,13 @@ def get_playwright_headless() -> bool:
|
||||
Reads from PLAYWRIGHT_HEADLESS environment variable, defaults to True.
|
||||
Returns True for headless mode (invisible browser), False for visible browser.
|
||||
"""
|
||||
value = os.getenv("PLAYWRIGHT_HEADLESS", str(DEFAULT_PLAYWRIGHT_HEADLESS).lower()).lower()
|
||||
# Accept various truthy/falsy values
|
||||
return value in ("true", "1", "yes", "on")
|
||||
value = os.getenv("PLAYWRIGHT_HEADLESS", str(DEFAULT_PLAYWRIGHT_HEADLESS).lower()).strip().lower()
|
||||
truthy = {"true", "1", "yes", "on"}
|
||||
falsy = {"false", "0", "no", "off"}
|
||||
if value not in truthy | falsy:
|
||||
print(f" - Warning: Invalid PLAYWRIGHT_HEADLESS='{value}', defaulting to {DEFAULT_PLAYWRIGHT_HEADLESS}")
|
||||
return DEFAULT_PLAYWRIGHT_HEADLESS
|
||||
return value in truthy
|
||||
|
||||
|
||||
def get_playwright_browser() -> str:
|
||||
|
||||
@@ -172,6 +172,32 @@ select:focus {
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
/* ===== KEYBOARD ACCESSIBILITY ===== */
|
||||
/* Focus-visible styles for keyboard navigation */
|
||||
.neo-btn:focus-visible,
|
||||
[class*="neo-btn"]:focus-visible,
|
||||
button:focus-visible {
|
||||
outline: 2px solid var(--color-neo-accent) !important;
|
||||
outline-offset: 2px !important;
|
||||
}
|
||||
|
||||
.neo-input:focus-visible,
|
||||
.neo-textarea:focus-visible,
|
||||
input:focus-visible,
|
||||
textarea:focus-visible,
|
||||
select:focus-visible {
|
||||
outline: 2px solid var(--color-neo-accent) !important;
|
||||
outline-offset: 2px !important;
|
||||
border-color: var(--color-neo-accent) !important;
|
||||
}
|
||||
|
||||
a:focus-visible,
|
||||
[role="button"]:focus-visible,
|
||||
[tabindex]:focus-visible {
|
||||
outline: 2px solid var(--color-neo-accent) !important;
|
||||
outline-offset: 2px !important;
|
||||
}
|
||||
|
||||
/* ===== BADGES ===== */
|
||||
.neo-badge,
|
||||
[class*="neo-badge"] {
|
||||
|
||||
Reference in New Issue
Block a user