Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/components/layout/DragBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DEBOUNCE_MS = 120;

export function SearchBar() {
const { t } = useTranslation();
const { searchQuery, setSearchQuery, activeTab } = useAppStore();
const { searchQuery, setSearchQuery, activeTab, windowOpenCount } = useAppStore();
const inputRef = useRef<HTMLInputElement>(null);
const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);

Expand Down Expand Up @@ -41,6 +41,16 @@ export function SearchBar() {
};
}, []);

// Put the caret in the search box on every window open (settings tab hides
// the bar, so inputRef is simply null there). This lets the user type to
// filter straight away and takes focus off whichever sidebar button the OS
// restored it to — otherwise that restore reads as focus-visible and paints
// a stray ring on launch.
useEffect(() => {
const id = requestAnimationFrame(() => inputRef.current?.focus());
return () => cancelAnimationFrame(id);
}, [windowOpenCount]);

// Auto-focus search when user starts typing (like Spotlight)
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
Expand Down Expand Up @@ -72,7 +82,7 @@ export function SearchBar() {
>
<div
role="search"
className="flex-1 flex items-center gap-2 h-8 px-2.5 bg-surface rounded-md cursor-text no-drag transition-shadow duration-150 ease-out focus-within:ring-2 focus-within:ring-accent/15 focus-within:border-accent/40"
className="flex-1 flex items-center gap-2 h-8 px-2.5 bg-surface rounded-md cursor-text no-drag"
onClick={() => inputRef.current?.focus()}
>
<Search className="w-3.5 h-3.5 text-muted-foreground shrink-0" />
Expand Down
10 changes: 6 additions & 4 deletions src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ export function Sidebar() {
aria-label={label}
onClick={() => handleTabChange(id)}
className={cn(
// Keyboard users need a visible focus target: suppress the mouse-click
// outline, but keep the focus-visible ring.
'group relative w-8 h-8 flex items-center justify-center rounded-lg transition-all duration-100 ease-out cursor-pointer no-drag outline-none focus-visible:ring-2 focus-visible:ring-accent',
// No focus ring here: the window restores focus to the last-clicked
// sidebar button on every re-open, which browsers treat as
// focus-visible — a stray orange ring on launch. The active tab's
// accent fill already shows which view is selected.
'group relative w-8 h-8 flex items-center justify-center rounded-lg transition-all duration-100 ease-out cursor-pointer no-drag outline-none',
isActive
? 'bg-accent/15 text-accent'
: 'text-foreground/55 hover:text-foreground/80 hover:bg-surface-hover'
Expand Down Expand Up @@ -84,7 +86,7 @@ export function Sidebar() {
aria-pressed={isCapturePaused}
onClick={() => toggleCapturePaused()}
className={cn(
'group relative w-8 h-8 flex items-center justify-center rounded-lg transition-all duration-100 ease-out cursor-pointer no-drag outline-none focus-visible:ring-2 focus-visible:ring-accent',
'group relative w-8 h-8 flex items-center justify-center rounded-lg transition-all duration-100 ease-out cursor-pointer no-drag outline-none',
isCapturePaused
? 'bg-amber-500/15 text-amber-500'
: 'text-foreground/55 hover:text-foreground/80 hover:bg-surface-hover'
Expand Down
Loading