Skip to content

Commit c1c1fbc

Browse files
feat(customize): add Ctrl+K / Cmd+K shortcut to focus username input
1 parent 8af10bd commit c1c1fbc

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

app/customize/page.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,20 @@ export default function CustomizePage(): ReactElement {
3939
};
4040
}, []);
4141

42-
// Clear custom hex overrides when switching to auto — fixed colors
43-
// conflict with the dual-palette prefers-color-scheme switching.
42+
useEffect(() => {
43+
const handleKeyDown = (event: KeyboardEvent) => {
44+
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'k') {
45+
const input = document.querySelector<HTMLInputElement>('#username-input');
46+
if (!input || document.activeElement === input) return;
47+
event.preventDefault();
48+
input.focus();
49+
}
50+
};
51+
52+
window.addEventListener('keydown', handleKeyDown);
53+
return () => window.removeEventListener('keydown', handleKeyDown);
54+
}, []);
55+
4456
// Clear custom hex overrides when switching to virtual themes because
4557
// fixed colors conflict with their palette-selection behavior.
4658
const handleThemeChange = useCallback((newTheme: string): void => {

0 commit comments

Comments
 (0)