fix(FN-1207): improve mobile header search behavior

- Replace delayed focus effect with native autoFocus on the mobile search input
- Constrain expanded mobile search positioning and width to prevent overflow on small viewports
- Add Header tests covering mobile search auto-focus and expanded container rendering
This commit is contained in:
gsxdsm
2026-04-08 15:41:18 -07:00
parent d66300c794
commit 0304a3df20
3 changed files with 42 additions and 10 deletions

View File

@@ -195,13 +195,6 @@ export function Header({
return () => document.removeEventListener("keydown", handleKeyDown);
}, []);
// Focus input when mobile search opens
useEffect(() => {
if (isMobileSearchOpen && mobileSearchInputRef.current) {
setTimeout(() => mobileSearchInputRef.current?.focus(), 0);
}
}, [isMobileSearchOpen]);
const handleMobileSearchToggle = useCallback(() => {
setIsMobileSearchOpen((prev) => !prev);
}, []);
@@ -335,6 +328,7 @@ export function Header({
<Search size={14} className="header-search-icon" />
<input
ref={mobileSearchInputRef}
autoFocus
type="text"
placeholder="Search tasks..."
value={searchQuery}