Only focus window on initial load
Some checks are pending
Tests / tests (push) Waiting to run

This commit is contained in:
Dustin Brett 2025-01-12 23:02:44 -08:00
parent a304b8d0a1
commit c6c2edc261
2 changed files with 3 additions and 2 deletions

View File

@ -134,6 +134,7 @@ const FileManager: FC<FileManagerProps> = ({
); );
const [permission, setPermission] = useState<PermissionState>("prompt"); const [permission, setPermission] = useState<PermissionState>("prompt");
const requestingPermissions = useRef(false); const requestingPermissions = useRef(false);
const focusedOnLoad = useRef(false);
const onKeyDown = useMemo( const onKeyDown = useMemo(
() => (renaming === "" ? keyShortcuts() : undefined), () => (renaming === "" ? keyShortcuts() : undefined),
[keyShortcuts, renaming] [keyShortcuts, renaming]
@ -207,8 +208,9 @@ const FileManager: FC<FileManagerProps> = ({
}, [currentUrl, folderActions, url]); }, [currentUrl, folderActions, url]);
useEffect(() => { useEffect(() => {
if (!loading && !isDesktop && !isStartMenu) { if (!focusedOnLoad.current && !loading && !isDesktop && !isStartMenu) {
fileManagerRef.current?.focus(PREVENT_SCROLL); fileManagerRef.current?.focus(PREVENT_SCROLL);
focusedOnLoad.current = true;
} }
}, [isDesktop, isStartMenu, loading]); }, [isDesktop, isStartMenu, loading]);

View File

@ -49,7 +49,6 @@ export const useSnapshots = (): Snapshot => {
} }
} }
// TODO: Update icon but don't focus
updateFolder(dirname(savePath)); updateFolder(dirname(savePath));
updateFolder(savePath, saveName); updateFolder(savePath, saveName);
} catch { } catch {