mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-08 07:12:49 +00:00
[Fix] Dropdown focus when app is launching (#563)
fix(Interface): Removed the focus when app is launching
This commit is contained in:
parent
b94eab8517
commit
07401ac08f
|
@ -1,7 +1,7 @@
|
||||||
import { ReactComponent as Ellipsis } from '@sd/assets/svgs/ellipsis.svg';
|
import { ReactComponent as Ellipsis } from '@sd/assets/svgs/ellipsis.svg';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { CheckCircle, CirclesFour, Gear, Lock, Planet, Plus } from 'phosphor-react';
|
import { CheckCircle, CirclesFour, Gear, Lock, Planet, Plus } from 'phosphor-react';
|
||||||
import React, { PropsWithChildren } from 'react';
|
import React, { PropsWithChildren, useEffect } from 'react';
|
||||||
import { NavLink, NavLinkProps } from 'react-router-dom';
|
import { NavLink, NavLinkProps } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
Location,
|
Location,
|
||||||
|
@ -51,6 +51,16 @@ export function Sidebar() {
|
||||||
const { library, libraries, isLoading: isLoadingLibraries, switchLibrary } = useCurrentLibrary();
|
const { library, libraries, isLoading: isLoadingLibraries, switchLibrary } = useCurrentLibrary();
|
||||||
const debugState = useDebugState();
|
const debugState = useDebugState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Prevent the dropdown button to be auto focused on launch
|
||||||
|
// Hacky but it works
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!document.activeElement || !('blur' in document.activeElement)) return;
|
||||||
|
|
||||||
|
(document.activeElement.blur as () => void)();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidebarBody className={macOnly(os, 'bg-opacity-[0.75]')}>
|
<SidebarBody className={macOnly(os, 'bg-opacity-[0.75]')}>
|
||||||
<WindowControls />
|
<WindowControls />
|
||||||
|
|
Loading…
Reference in a new issue