Skip to content

Commit

Permalink
frontend: minor tab navigation fix for dropdown menus
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDotJS committed Jul 28, 2024
1 parent 2d3f9da commit ef925d6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/renderer/src/components/common/DropDownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DropDownCollectionContext } from './DropDownCollection';
import style from './DropDown.module.css';

const DropDown = (props: { label: string, children?: JSXElement }): JSXElement => {
const { activated, selectedId, setSelectedId, targetElement, setTargetElement } = useContext(DropDownCollectionContext);
const { activated, setActivated, selectedId, setSelectedId, targetElement, setTargetElement } = useContext(DropDownCollectionContext);

const buttonId = createUniqueId();
let lastTarget: Element|null = null;
Expand Down Expand Up @@ -40,14 +40,19 @@ const DropDown = (props: { label: string, children?: JSXElement }): JSXElement =
startCountdown();
};

const clickHandler = (): void => {
setActivated(true);
updateSelected();
};

return (
<>
<button
class={style.dropdownButton}
onPointerOver={() => updateSelected()}
classList={{ [style.opened]: activated() && isSelected() }}
onPointerMove={(ev) => movement(ev)}
// onClick={() => cancelCountdown()}
onClick={() => clickHandler()}
>
{props.label}
<Show when={activated() && isSelected()}>
Expand Down

0 comments on commit ef925d6

Please sign in to comment.