Skip to content

Commit 6c986a8

Browse files
committed
Revert "chore: More internal stsn exports (#156)"
This reverts commit 96fb0e3.
1 parent 96fb0e3 commit 6c986a8

File tree

5 files changed

+3
-50
lines changed

5 files changed

+3
-50
lines changed

src/internal/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export { getGlobalFlag } from './global-flags';
3131
export {
3232
SingleTabStopNavigationAPI,
3333
SingleTabStopNavigationProvider,
34-
SingleTabStopNavigationReset,
3534
useSingleTabStopNavigation,
3635
} from './single-tab-stop';
3736
export { isFocusable, getAllFocusables, getFirstFocusable, getLastFocusable } from './focus-lock-utils/utils';

src/internal/single-tab-stop/__tests__/context.test.tsx

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
SingleTabStopNavigationAPI,
99
SingleTabStopNavigationContext,
1010
SingleTabStopNavigationProvider,
11-
SingleTabStopNavigationReset,
1211
useSingleTabStopNavigation,
1312
} from '../';
1413
import { renderWithSingleTabStopNavigation } from './utils';
@@ -248,42 +247,4 @@ describe('nested contexts', () => {
248247
expect(findGroupButton('inner', 0)).toHaveAttribute('tabindex', '0');
249248
expect(findGroupButton('inner', 1)).toHaveAttribute('tabindex', '-1');
250249
});
251-
252-
test('ignores parent context when reset is used', () => {
253-
const { rerender } = render(
254-
<Group id="outer-most" navigationActive={true}>
255-
<SingleTabStopNavigationReset>
256-
<Group id="outer" navigationActive={true}>
257-
<Group id="inner" navigationActive={true}>
258-
{null}
259-
</Group>
260-
</Group>
261-
</SingleTabStopNavigationReset>
262-
</Group>
263-
);
264-
expect(findGroupButton('outer-most', 0)).toHaveAttribute('tabindex', '0');
265-
expect(findGroupButton('outer-most', 1)).toHaveAttribute('tabindex', '-1');
266-
expect(findGroupButton('outer', 0)).toHaveAttribute('tabindex', '0');
267-
expect(findGroupButton('outer', 1)).toHaveAttribute('tabindex', '-1');
268-
expect(findGroupButton('inner', 0)).toHaveAttribute('tabindex', '-1');
269-
expect(findGroupButton('inner', 1)).toHaveAttribute('tabindex', '-1');
270-
271-
rerender(
272-
<Group id="outer-most" navigationActive={true}>
273-
<Group id="outer" navigationActive={true}>
274-
<SingleTabStopNavigationReset>
275-
<Group id="inner" navigationActive={true}>
276-
{null}
277-
</Group>
278-
</SingleTabStopNavigationReset>
279-
</Group>
280-
</Group>
281-
);
282-
expect(findGroupButton('outer-most', 0)).toHaveAttribute('tabindex', '0');
283-
expect(findGroupButton('outer-most', 1)).toHaveAttribute('tabindex', '-1');
284-
expect(findGroupButton('outer', 0)).toHaveAttribute('tabindex', '-1');
285-
expect(findGroupButton('outer', 1)).toHaveAttribute('tabindex', '-1');
286-
expect(findGroupButton('inner', 0)).toHaveAttribute('tabindex', '0');
287-
expect(findGroupButton('inner', 1)).toHaveAttribute('tabindex', '-1');
288-
});
289250
});

src/internal/single-tab-stop/__tests__/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const FakeSingleTabStopNavigationProvider = forwardRef(
3737

3838
return (
3939
<SingleTabStopNavigationContext.Provider
40-
value={{ navigationActive, registerFocusable, resetFocusTarget: () => {} }}
40+
value={{ registerFocusable, navigationActive, resetFocusTarget: () => {} }}
4141
>
4242
{children}
4343
</SingleTabStopNavigationContext.Provider>

src/internal/single-tab-stop/index.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import nodeBelongs from '../../dom/node-belongs';
1616

1717
export type FocusableChangeHandler = (isFocusable: boolean) => void;
1818

19-
const defaultValue: {
19+
export const defaultValue: {
2020
navigationActive: boolean;
2121
registerFocusable(focusable: HTMLElement, handler: FocusableChangeHandler): () => void;
2222
resetFocusTarget(): void;
@@ -71,12 +71,6 @@ export interface SingleTabStopNavigationAPI {
7171
isRegistered(element: Element): boolean;
7272
}
7373

74-
export function SingleTabStopNavigationReset({ children }: { children: React.ReactNode }) {
75-
return (
76-
<SingleTabStopNavigationContext.Provider value={defaultValue}>{children}</SingleTabStopNavigationContext.Provider>
77-
);
78-
}
79-
8074
export const SingleTabStopNavigationProvider = forwardRef(
8175
(
8276
{
@@ -164,7 +158,7 @@ export const SingleTabStopNavigationProvider = forwardRef(
164158
const parentContext = useContext(SingleTabStopNavigationContext);
165159
const value = parentContext.navigationActive
166160
? parentContext
167-
: { navigationReset: false, navigationActive, registerFocusable, updateFocusTarget, resetFocusTarget };
161+
: { navigationActive, registerFocusable, updateFocusTarget, resetFocusTarget };
168162

169163
// When contexts switching occurs, it is essential that the now-active one updates the focus target
170164
// to ensure the tab indices are correctly set.

src/internal/testing.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ export { clearOneTimeMetricsCache } from './base-component/metrics/metrics';
55
export { clearMessageCache } from './logging';
66
export { setGlobalFlag } from './global-flags';
77
export { clearVisualRefreshState } from './visual-mode';
8-
export { renderWithSingleTabStopNavigation } from './single-tab-stop/__tests__/utils';

0 commit comments

Comments
 (0)