Skip to content

Commit 1fa80c1

Browse files
committed
Reverting the clean up of IContext
1 parent d74fee9 commit 1fa80c1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/shared-components/src/core/roving/RovingTabIndex.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ export interface IState {
4848
nodes: HTMLElement[];
4949
}
5050

51-
interface ContextValue {
51+
/**
52+
* The value exposed by {@link RovingTabIndexContext}.
53+
*/
54+
export interface IContext {
5255
state: IState;
5356
dispatch: Dispatch<IAction>;
5457
}
@@ -57,7 +60,7 @@ interface ContextValue {
5760
* React context used by roving tabindex participants to register themselves and
5861
* update the active item.
5962
*/
60-
export const RovingTabIndexContext = createContext<ContextValue>({
63+
export const RovingTabIndexContext = createContext<IContext>({
6164
state: {
6265
nodes: [], // list of nodes in DOM order
6366
},
@@ -336,7 +339,7 @@ export const RovingTabIndexProvider: React.FC<RovingTabIndexProviderProps> = ({
336339
nodes: [],
337340
});
338341

339-
const context = useMemo<ContextValue>(() => ({ state, dispatch }), [state]);
342+
const context = useMemo<IContext>(() => ({ state, dispatch }), [state]);
340343

341344
const onKeyDownHandler = useCallback(
342345
(ev: KeyboardEvent) => {

packages/shared-components/src/core/roving/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ export {
1414
RovingTabIndexProvider,
1515
useRovingTabIndex,
1616
} from "./RovingTabIndex";
17-
export type { IAction, IState, RovingTabIndexProviderProps } from "./RovingTabIndex";
17+
export type { IAction, IContext, IState, RovingTabIndexProviderProps } from "./RovingTabIndex";
1818
export { RovingTabIndexWrapper } from "./RovingTabIndexWrapper";

0 commit comments

Comments
 (0)