Skip to content

Commit

Permalink
Keyboard navigation for search facets
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyichen committed May 14, 2024
1 parent 4ec6ebd commit 029358b
Show file tree
Hide file tree
Showing 4 changed files with 321 additions and 31 deletions.
25 changes: 25 additions & 0 deletions src/components/SearchFacet/FacetContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { noop } from '@utils';
import { createContext, Dispatch, SetStateAction } from 'react';
import { KeyboardFocusItem } from './types';

export const FacetContext = createContext<{
keyboardFocus: KeyboardFocusItem;
setKeyboardFocus: Dispatch<SetStateAction<KeyboardFocusItem>>;
expanded: string[];
setExpanded: Dispatch<SetStateAction<string[]>>;
childrenCount: {
[key: string]: number;
};
setChildrenCount: Dispatch<
SetStateAction<{
[key: string]: number;
}>
>;
}>({
keyboardFocus: null,
setKeyboardFocus: noop,
expanded: [],
setExpanded: noop,
childrenCount: {},
setChildrenCount: noop,
});
Loading

0 comments on commit 029358b

Please sign in to comment.