Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(ui): keyboard a11y hardening + quieter brand chrome

Juan Denis768100462c5b
diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx
index d13fa989..756495fc 100644
--- a/frontend/src/components/Sidebar.jsx
+++ b/frontend/src/components/Sidebar.jsx
@@ -7,18 +7,15 @@ import { api } from '../services/api';
import ServerKitLogo from './ServerKitLogo';
import { SIDEBAR_CATEGORIES, CATEGORY_LABELS, SIDEBAR_PRESETS, getHiddenItemIds, getVisibleItems } from './sidebarItems';
import { useContributions } from '../plugins/contributions';
-import useMediaQuery from '../hooks/useMediaQuery';
const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {} }) => {
const { user, logout, updateUser } = useAuth();
const { theme, resolvedTheme, setTheme, whiteLabel } = useTheme();
const navigate = useNavigate();
- const [starAnimating, setStarAnimating] = useState(false);
const [menuOpen, setMenuOpen] = useState(false);
const [wpInstalled, setWpInstalled] = useState(false);
const menuRef = useRef(null);
const sidebarRef = useRef(null);
- const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
// When collapsed to a drawer and closed, take the whole subtree out of the
// tab order and the accessibility tree. `inert` is set imperatively so it
@@ -72,16 +69,27 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
};
}, [isMobile, mobileOpen, onMobileClose]);
- // Close menu when clicking outside
+ // Close the user menu on outside click or Escape; return focus to the
+ // trigger when Escape dismisses it.
useEffect(() => {
- if (!menuOpen) return;
+ if (!menuOpen) return undefined;
const handleClickOutside = (e) => {
if (menuRef.current && !menuRef.current.contains(e.target)) {
setMenuOpen(false);
}
};
+ const handleKeyDown = (e) => {
+ if (e.key === 'Escape') {
+ setMenuOpen(false);
+ menuRef.current?.querySelector('.user-mini')?.focus();
+ }
+ };
document.addEventListener('mousedown', handleClickOutside);
- return () => document.removeEventListener('mousedown', handleClickOutside);
+ document.addEventListener('keydown', handleKeyDown);
+ return () => {
+ document.removeEventListener('mousedown', handleClickOutside);
+ document.removeEventListener('keydown', handleKeyDown);
+ };
}, [menuOpen]);
// Check if WordPress is installed
@@ -91,43 +99,6 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
.catch(() => setWpInstalled(false));
}, []);
- useEffect(() => {
- // The star's celebratory burst is pure decoration: never auto-play it
- // for users who asked the OS to reduce motion.
- if (whiteLabel.enabled || prefersReducedMotion) return;
-
- let playCount = 0;
- let timeoutId;
-
- const triggerAnimation = () => {
- setStarAnimating(true);
- setTimeout(() => setStarAnimating(false), 1500);
- playCount++;
- };
-
- const scheduleNext = () => {
- const multiplier = playCount + 1;
- const minMinutes = 8 * multiplier;
- const maxMinutes = 11 * multiplier;
- const delay = (Math.random() * (maxMinutes - minMinutes) + minMinutes) * 60 * 1000;
-
- timeoutId = setTimeout(() => {
- triggerAnimation();
- scheduleNext();
- }, delay);
- };
-
- const initialDelay = setTimeout(() => {
- triggerAnimation();
- scheduleNext();
- }, 60000);
-
- return () => {
- clearTimeout(initialDelay);
- clearTimeout(timeoutId);
- };
- }, [whiteLabel.enabled, prefersReducedMotion]);
-
const conditions = { wpInstalled };
const currentPreset = user?.sidebar_config?.preset || 'full';
const [manualExpanded, setManualExpanded] = useState({});
@@ -215,16 +186,20 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
end={item.end || hasChildren}
>
<svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
+ aria-hidden="true" focusable="false"
dangerouslySetInnerHTML={{ __html: item.icon }}
/>
{item.label}
</NavLink>
{visibleSubs.length > 0 && (
<button
+ type="button"
className={`nav-expand-btn ${isExpanded ? 'expanded' : ''}`}
+ aria-expanded={isExpanded}
+ aria-label={`${isExpanded ? 'Collapse' : 'Expand'} ${item.label}`}
onClick={(e) => { e.stopPropagation(); toggleExpand(item.id); }}
>
- <ChevronRight size={14} />
+ <ChevronRight size={14} aria-hidden="true" />
</button>
)}
</div>
@@ -235,6 +210,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
className={({ isActive }) => `nav-item nav-sub-item ${isActive ? 'active' : ''}`}
>
<svg className="nav-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
+ aria-hidden="true" focusable="false"
dangerouslySetInnerHTML={{ __html: sub.icon }}
/>
{sub.label}
@@ -300,17 +276,11 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
href="https://github.com/jhd3197/ServerKit"
target="_blank"
rel="noopener noreferrer"
- className={`brand-star ${starAnimating ? 'animating' : ''}`}
+ className="brand-star"
+ aria-label="Star ServerKit on GitHub"
title="Star on GitHub"
>
- <Star size={14} />
- <span className="star-particles">
- <span></span><span></span><span></span><span></span><span></span><span></span>
- </span>
- <span className="star-ring"></span>
- <span className="star-ring ring-2"></span>
- <span className="star-ring ring-3"></span>
- <span className="star-tooltip">Star us!</span>
+ <Star size={14} aria-hidden="true" />
</a>
</div>
)}
@@ -370,91 +340,112 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
<div className="sidebar-footer" ref={menuRef}>
{menuOpen && (
- <div className="user-context-menu">
+ <div className="user-context-menu" id="user-context-menu" aria-label="Account and preferences">
<div className="context-menu-section">
- <div className="context-menu-label">Theme</div>
- <div className="theme-switcher">
+ <div className="context-menu-label" id="theme-switcher-label">Theme</div>
+ <div className="theme-switcher" role="group" aria-labelledby="theme-switcher-label">
<button
+ type="button"
className={`theme-btn ${theme === 'dark' ? 'active' : ''}`}
onClick={() => setTheme('dark')}
+ aria-label="Dark theme"
+ aria-pressed={theme === 'dark'}
title="Dark"
>
- <Moon size={14} />
+ <Moon size={14} aria-hidden="true" />
</button>
<button
+ type="button"
className={`theme-btn ${theme === 'light' ? 'active' : ''}`}
onClick={() => setTheme('light')}
+ aria-label="Light theme"
+ aria-pressed={theme === 'light'}
title="Light"
>
- <Sun size={14} />
+ <Sun size={14} aria-hidden="true" />
</button>
<button
+ type="button"
className={`theme-btn ${theme === 'system' ? 'active' : ''}`}
onClick={() => setTheme('system')}
+ aria-label="System theme"
+ aria-pressed={theme === 'system'}
title="System"
>
- <Monitor size={14} />
+ <Monitor size={14} aria-hidden="true" />
</button>
</div>
</div>
<div className="context-menu-section">
- <div className="context-menu-label">Sidebar View</div>
- <div className="view-switcher">
+ <div className="context-menu-label" id="sidebar-view-label">Sidebar View</div>
+ <div className="view-switcher" role="group" aria-labelledby="sidebar-view-label">
{Object.entries(SIDEBAR_PRESETS).map(([key, preset]) => (
<button
key={key}
+ type="button"
className={`view-btn ${currentPreset === key ? 'active' : ''}`}
onClick={() => handlePresetSwitch(key)}
+ aria-pressed={currentPreset === key}
title={preset.description}
>
{preset.label}
- {currentPreset === key && <Check size={10} />}
+ {currentPreset === key && <Check size={10} aria-hidden="true" />}
</button>
))}
</div>
</div>
<div className="context-menu-divider" />
<button
+ type="button"
className="context-menu-item"
onClick={() => { navigate('/settings/appearance'); setMenuOpen(false); }}
>
- <Palette size={15} />
+ <Palette size={15} aria-hidden="true" />
Appearance
- <ChevronRight size={14} className="context-menu-arrow" />
+ <ChevronRight size={14} className="context-menu-arrow" aria-hidden="true" />
</button>
<button
+ type="button"
className="context-menu-item"
onClick={() => { navigate('/settings/sidebar'); setMenuOpen(false); }}
>
- <PanelLeft size={15} />
+ <PanelLeft size={15} aria-hidden="true" />
Customize Sidebar
- <ChevronRight size={14} className="context-menu-arrow" />
+ <ChevronRight size={14} className="context-menu-arrow" aria-hidden="true" />
</button>
<button
+ type="button"
className="context-menu-item"
onClick={() => { navigate('/settings'); setMenuOpen(false); }}
>
- <Settings size={15} />
+ <Settings size={15} aria-hidden="true" />
All Settings
- <ChevronRight size={14} className="context-menu-arrow" />
+ <ChevronRight size={14} className="context-menu-arrow" aria-hidden="true" />
</button>
<div className="context-menu-divider" />
- <button className="context-menu-item danger" onClick={logout}>
- <LogOut size={15} />
+ <button type="button" className="context-menu-item danger" onClick={logout}>
+ <LogOut size={15} aria-hidden="true" />
Log out
</button>
</div>
)}
- <div className="user-mini" onClick={() => setMenuOpen(!menuOpen)}>
- <div className="user-avatar">
+ <button
+ type="button"
+ className="user-mini"
+ onClick={() => setMenuOpen(!menuOpen)}
+ aria-haspopup="true"
+ aria-expanded={menuOpen}
+ aria-controls="user-context-menu"
+ >
+ <span className="user-avatar" aria-hidden="true">
{user?.username?.charAt(0).toUpperCase() || 'U'}
- </div>
- <div className="user-meta">
+ </span>
+ <span className="user-meta">
<span className="user-handle">{user?.username || 'User'}</span>
<span className="user-status">Online</span>
- </div>
- <ChevronUp size={14} className={`user-menu-arrow ${menuOpen ? 'open' : ''}`} />
- </div>
+ </span>
+ <ChevronUp size={14} className={`user-menu-arrow ${menuOpen ? 'open' : ''}`} aria-hidden="true" />
+ </button>
</div>
</aside>
);
diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx
index 1ef159de..3cdbd31c 100644
--- a/frontend/src/pages/Dashboard.jsx
+++ b/frontend/src/pages/Dashboard.jsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect, useCallback } from 'react';
-import { useNavigate } from 'react-router-dom';
+import { useNavigate, Link } from 'react-router-dom';
import {
HardDrive, Activity,
RefreshCw, Zap,
@@ -415,8 +415,14 @@ const Dashboard = () => {
<td>{app.id}</td>
<td>
<div className="app-name-cell">
- <span className="app-icon-mini">{getStackIcon(app.app_type)}</span>
- {app.name}
+ <span className="app-icon-mini" aria-hidden="true">{getStackIcon(app.app_type)}</span>
+ <Link
+ to={`/apps/${app.id}`}
+ className="app-name-link"
+ onClick={(e) => e.stopPropagation()}
+ >
+ {app.name}
+ </Link>
</div>
</td>
<td>{app.app_type}</td>
diff --git a/frontend/src/styles/base/_reset.scss b/frontend/src/styles/base/_reset.scss
index 56859b10..3bb1cdc7 100644
--- a/frontend/src/styles/base/_reset.scss
+++ b/frontend/src/styles/base/_reset.scss
@@ -6,9 +6,21 @@
margin: 0;
padding: 0;
box-sizing: border-box;
+}
+
+// Focus visibility (app-wide baseline).
+// Suppress the ring for pointer/mouse focus, but guarantee a consistent,
+// visible accent ring for keyboard users on every focusable element.
+// Components may override with a tuned ring (offset/radius) as needed.
+:focus:not(:focus-visible) {
outline: none;
}
+:focus-visible {
+ outline: 2px solid var(--accent-primary);
+ outline-offset: 2px;
+}
+
html {
font-size: 16px;
-webkit-font-smoothing: antialiased;
diff --git a/frontend/src/styles/layout/_sidebar.scss b/frontend/src/styles/layout/_sidebar.scss
index 3d2ef93c..057df0e5 100644
--- a/frontend/src/styles/layout/_sidebar.scss
+++ b/frontend/src/styles/layout/_sidebar.scss
@@ -197,13 +197,10 @@
font-weight: $font-weight-bold;
color: $text-primary;
letter-spacing: -0.02em;
- background: linear-gradient(135deg, $text-primary 0%, #a5b4fc 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
}
-// Star button in brand section
+// Star button in brand section — a quiet "star us on GitHub" affordance.
+// Color + a faint wash on hover; no burst, rings, or auto-play.
.brand-star {
margin-left: auto;
display: flex;
@@ -213,289 +210,12 @@
height: $sidebar-icon-size;
border-radius: 50%;
color: $text-tertiary;
- transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
- position: relative;
- overflow: visible;
-
- svg {
- position: relative;
- z-index: 2;
- transition: all 0.3s ease;
- }
-
- .star-particles,
- .star-ring,
- .star-tooltip {
- pointer-events: none;
- position: absolute;
- }
-
- .star-particles {
- inset: 0;
-
- span {
- position: absolute;
- width: 4px;
- height: 4px;
- background: $color-star;
- border-radius: 50%;
- opacity: 0;
- top: 50%;
- left: 50%;
- }
- }
-
- .star-ring {
- inset: 0;
- border-radius: 50%;
- border: 2px solid $color-star;
- opacity: 0;
- transform: scale(0.8);
- }
-
- .star-tooltip {
- top: 50%;
- left: calc(100% + 10px);
- transform: translateY(-50%) translateX(-4px);
- background: linear-gradient(135deg, $color-star 0%, #d97706 100%);
- color: white;
- font-size: 0.65rem;
- font-weight: 600;
- padding: 4px 10px;
- border-radius: 6px;
- white-space: nowrap;
- opacity: 0;
- box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
-
- &::after {
- content: '';
- position: absolute;
- top: 50%;
- left: -4px;
- transform: translateY(-50%);
- border-top: 5px solid transparent;
- border-bottom: 5px solid transparent;
- border-right: 5px solid #d97706;
- }
- }
+ transition: color $transition-base, background-color $transition-base;
+ @include focus-ring();
&:hover {
color: $color-star;
- background: rgba(245, 158, 11, 0.15);
- transform: scale(1.1);
- box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
- }
-
- &:active {
- transform: scale(0.95);
- }
-
- // Animation state
- &.animating {
- animation: starPop 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
-
- svg {
- color: $color-star;
- animation: starSpin 1.5s cubic-bezier(0.34, 1.56, 0.64, 1), starGlow 1.5s ease-in-out;
- }
-
- // Particles explosion
- .star-particles span {
- animation: particleBurst 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
-
- &:nth-child(1) { --angle: 0deg; --distance: 20px; animation-delay: 0.1s; }
- &:nth-child(2) { --angle: 60deg; --distance: 24px; animation-delay: 0.15s; }
- &:nth-child(3) { --angle: 120deg; --distance: 18px; animation-delay: 0.1s; }
- &:nth-child(4) { --angle: 180deg; --distance: 22px; animation-delay: 0.2s; }
- &:nth-child(5) { --angle: 240deg; --distance: 20px; animation-delay: 0.12s; }
- &:nth-child(6) { --angle: 300deg; --distance: 26px; animation-delay: 0.18s; }
- }
-
- // Multiple rings
- .star-ring {
- animation: ringExpand 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
-
- &.ring-2 {
- animation-delay: 0.15s;
- border-color: #fbbf24;
- }
-
- &.ring-3 {
- animation-delay: 0.3s;
- border-color: #fcd34d;
- border-width: 1px;
- }
- }
-
- // Tooltip appears
- .star-tooltip {
- animation: tooltipPop 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
- }
-
- // Background flash
- &::before {
- content: '';
- position: absolute;
- inset: -4px;
- border-radius: 50%;
- background: radial-gradient(circle, rgba(245, 158, 11, 0.4) 0%, transparent 70%);
- animation: bgFlash 0.6s ease-out forwards;
- z-index: -1;
- }
-
- // Shine sweep
- &::after {
- content: '';
- position: absolute;
- top: 0;
- left: -100%;
- width: 200%;
- height: 100%;
- background: linear-gradient(
- 90deg,
- transparent,
- rgba(255, 255, 255, 0.6),
- transparent
- );
- animation: shineSweep 0.5s 0.2s ease-out forwards;
- border-radius: 50%;
- z-index: 3;
- }
- }
-}
-
-// Star icon spin
-@keyframes starSpin {
- 0% {
- transform: rotate(0deg) scale(1);
- }
- 25% {
- transform: rotate(-15deg) scale(1.2);
- }
- 50% {
- transform: rotate(15deg) scale(1.3);
- }
- 75% {
- transform: rotate(-5deg) scale(1.1);
- }
- 100% {
- transform: rotate(0deg) scale(1);
- }
-}
-
-// Smooth bounce pop
-@keyframes starPop {
- 0% {
- transform: scale(1);
- }
- 20% {
- transform: scale(1.4);
- }
- 40% {
- transform: scale(1.1);
- }
- 60% {
- transform: scale(1.25);
- }
- 80% {
- transform: scale(1.15);
- }
- 100% {
- transform: scale(1);
- }
-}
-
-// Icon glow pulse
-@keyframes starGlow {
- 0%, 100% {
- filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4));
- }
- 30% {
- filter: drop-shadow(0 0 8px rgba(245, 158, 11, 1))
- drop-shadow(0 0 16px rgba(245, 158, 11, 0.8))
- drop-shadow(0 0 24px rgba(245, 158, 11, 0.4));
- }
- 60% {
- filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.8));
- }
-}
-
-// Particles burst outward
-@keyframes particleBurst {
- 0% {
- opacity: 1;
- transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0) scale(1);
- }
- 50% {
- opacity: 1;
- transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(var(--distance) * -0.7)) scale(1.2);
- }
- 100% {
- opacity: 0;
- transform: translate(-50%, -50%) rotate(var(--angle)) translateY(calc(var(--distance) * -1)) scale(0);
- }
-}
-
-// Ring that expands outward
-@keyframes ringExpand {
- 0% {
- transform: scale(0.8);
- opacity: 1;
- }
- 100% {
- transform: scale(2.5);
- opacity: 0;
- }
-}
-
-// Tooltip pop in and out
-@keyframes tooltipPop {
- 0% {
- opacity: 0;
- transform: translateY(-50%) translateX(-4px) scale(0.8);
- }
- 20% {
- opacity: 1;
- transform: translateY(-50%) translateX(0) scale(1.05);
- }
- 30% {
- transform: translateY(-50%) translateX(0) scale(1);
- }
- 70% {
- opacity: 1;
- transform: translateY(-50%) translateX(0) scale(1);
- }
- 100% {
- opacity: 0;
- transform: translateY(-50%) translateX(4px) scale(0.9);
- }
-}
-
-// Background glow flash
-@keyframes bgFlash {
- 0% {
- opacity: 0;
- transform: scale(0.5);
- }
- 30% {
- opacity: 1;
- transform: scale(1.5);
- }
- 100% {
- opacity: 0;
- transform: scale(2);
- }
-}
-
-// Shine sweep across
-@keyframes shineSweep {
- 0% {
- left: -200%;
- opacity: 1;
- }
- 100% {
- left: 100%;
- opacity: 0;
+ background: rgba(245, 158, 11, 0.12);
}
}
@@ -542,10 +262,7 @@
font-size: 1.15rem;
font-weight: $font-weight-bold;
letter-spacing: -0.02em;
- background: linear-gradient(135deg, $text-primary 0%, #a5b4fc 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
+ color: $text-primary;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -605,6 +322,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ @include focus-ring();
// Pro Hover State
&:hover {
@@ -660,6 +378,7 @@
flex-shrink: 0;
transition: all 0.15s ease;
margin-right: 4px;
+ @include focus-ring();
&:hover {
background: rgba(255, 255, 255, 0.06);
@@ -763,6 +482,7 @@
border-radius: $radius-sm;
cursor: pointer;
transition: all 0.15s ease;
+ @include focus-ring();
&:hover {
color: $text-primary;
@@ -794,6 +514,7 @@
border-radius: $radius-sm;
cursor: pointer;
transition: all 0.15s ease;
+ @include focus-ring();
&:hover {
border-color: $border-active;
@@ -829,6 +550,7 @@
cursor: pointer;
transition: all 0.15s ease;
text-align: left;
+ @include focus-ring();
&:hover {
background: rgba(255, 255, 255, 0.04);
@@ -856,10 +578,17 @@
display: flex;
align-items: center;
gap: 10px;
+ width: 100%;
padding: 0.5rem;
cursor: pointer;
+ border: none;
+ background: transparent;
+ color: inherit;
+ font: inherit;
+ text-align: left;
border-radius: $radius-lg;
transition: all 0.2s ease;
+ @include focus-ring();
&:hover {
background: $bg-secondary;
diff --git a/frontend/src/styles/pages/_dashboard.scss b/frontend/src/styles/pages/_dashboard.scss
index 449c0a52..436a64b4 100644
--- a/frontend/src/styles/pages/_dashboard.scss
+++ b/frontend/src/styles/pages/_dashboard.scss
@@ -298,6 +298,7 @@
justify-content: space-between;
align-items: center;
transition: all $transition-fast;
+ @include focus-ring();
&:hover {
border-color: $accent-primary;
@@ -367,6 +368,18 @@
color: $text-primary;
}
+.app-name-link {
+ color: $text-primary;
+ text-decoration: none;
+ border-radius: $radius-sm;
+ @include focus-ring();
+
+ &:hover {
+ color: $accent-primary;
+ text-decoration: underline;
+ }
+}
+
.app-icon-mini {
display: flex;
align-items: center;
@@ -491,6 +504,7 @@
padding: $space-2;
cursor: pointer;
transition: all $transition-fast;
+ @include focus-ring();
&:hover {
border-color: $accent-primary;