MCPcopy Create free account
hub / github.com/dailydotdev/apps / onTabKeyDown

Function onTabKeyDown

packages/shared/src/components/plus/PlusFeedBanner.tsx:94–114  ·  view source on GitHub ↗
(event: KeyboardEvent<HTMLButtonElement>)

Source from the content-addressed store, hash-verified

92 };
93
94 const onTabKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {
95 const index = plusBannerFeatures.findIndex((item) => item.id === selected);
96 const next = {
97 ArrowDown: index + 1,
98 ArrowRight: index + 1,
99 ArrowUp: index - 1,
100 ArrowLeft: index - 1,
101 Home: 0,
102 End: plusBannerFeatures.length - 1,
103 }[event.key];
104 if (next === undefined) {
105 return;
106 }
107 event.preventDefault();
108 const target =
109 plusBannerFeatures[
110 (next + plusBannerFeatures.length) % plusBannerFeatures.length
111 ];
112 select(target.id);
113 document.getElementById(tabId(target.id))?.focus();
114 };
115
116 return (
117 <section

Callers

nothing calls this directly

Calls 2

selectFunction · 0.70
tabIdFunction · 0.70

Tested by

no test coverage detected