Skip to content

Commit abc118f

Browse files
committed
removal tabpanel from tabs
1 parent 95b39c1 commit abc118f

File tree

3 files changed

+19
-35
lines changed

3 files changed

+19
-35
lines changed

src/app/components/client/TabList.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
import { Key, ReactNode, useRef } from "react";
6-
import {
7-
AriaTabListOptions,
8-
useTab,
9-
useTabList,
10-
useTabPanel,
11-
} from "react-aria";
6+
import { AriaTabListOptions, useTab, useTabList } from "react-aria";
127
import { Item, useTabListState } from "react-stately";
138
import styles from "./TabList.module.scss";
149
import { TabListState, TabListStateOptions } from "@react-stately/tabs";
@@ -64,19 +59,6 @@ function Tabs(props: TabsProps) {
6459
<Tab key={item.key} item={item} state={state} />
6560
))}
6661
</div>
67-
<TabPanel key={selectedItem?.key} state={state} />
68-
</div>
69-
);
70-
}
71-
72-
function TabPanel({ state, ...props }: { state: TabListState<object> }) {
73-
const ref = useRef(null);
74-
const { tabPanelProps } = useTabPanel(props, state, ref);
75-
const { selectedItem } = state;
76-
77-
return (
78-
<div {...tabPanelProps} ref={ref} className={styles.tabPanel}>
79-
{selectedItem?.props.children}
8062
</div>
8163
);
8264
}

src/app/components/client/toolbar/AppPicker.module.scss

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,14 @@
116116
}
117117
}
118118

119-
&.isFocused {
120-
outline: none;
121-
cursor: pointer;
122-
123-
.menuLink {
124-
color: tokens.$color-violet-90;
119+
// &:focus-visible {
120+
// outline-offset: calc(-1 * tokens.$border-focus-width);
121+
// outline: tokens.$border-focus-width solid tokens.$color-purple-10;
122+
// }
125123

126-
img {
127-
background-color: tokens.$color-violet-10;
128-
}
129-
}
124+
&:hover {
125+
outline: none;
126+
background-color: tokens.$color-purple-05;
130127
}
131128
}
132129
}

src/app/components/client/toolbar/AppPicker.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
useMenuItem,
2121
AriaMenuProps,
2222
AriaMenuTriggerProps,
23+
useFocusRing,
2324
} from "react-aria";
2425
import { useRef } from "react";
2526
import Image from "next/image";
@@ -222,9 +223,7 @@ type AppPickerMenuProps<T> = AriaMenuProps<T>;
222223
/* c8 ignore start */
223224
const AppPickerMenu = <T extends object>(props: AppPickerMenuProps<T>) => {
224225
const l10n = useL10n();
225-
226226
const menuState = useTreeState({ ...props });
227-
228227
const menuRef = useRef<HTMLDivElement>(null);
229228
const menuProps = useMenu(props, menuState, menuRef).menuProps;
230229

@@ -234,7 +233,12 @@ const AppPickerMenu = <T extends object>(props: AppPickerMenuProps<T>) => {
234233
<Image src={FirefoxLogo} alt="" width={32} height={32} />
235234
<h2>{l10n.getString("fx-makes-tech")}</h2>
236235
</div>
237-
<div {...menuProps} ref={menuRef} className={styles.menuWrapper}>
236+
<div
237+
{...menuProps}
238+
ref={menuRef}
239+
tabIndex={-1}
240+
className={styles.menuWrapper}
241+
>
238242
{Array.from(menuState.collection).map((item) => (
239243
<AppPickerItem key={item.key} item={item} state={menuState} />
240244
))}
@@ -257,8 +261,9 @@ const AppPickerItem = <T extends object>(props: AppPickerItemProps<T>) => {
257261
const anchorRef = useRef<HTMLAnchorElement>(null);
258262
const divRef = useRef<HTMLDivElement>(null);
259263
const ref = isLink ? anchorRef : divRef;
264+
const { focusProps } = useFocusRing();
260265

261-
const { menuItemProps, isFocused } = useMenuItem(
266+
const { menuItemProps } = useMenuItem(
262267
{
263268
key: props.item.key,
264269
},
@@ -267,8 +272,8 @@ const AppPickerItem = <T extends object>(props: AppPickerItemProps<T>) => {
267272
);
268273

269274
const commonProps = {
270-
...menuItemProps,
271-
className: `${styles.menuItemWrapper} ${isFocused ? styles.isFocused : ""}`,
275+
...mergeProps(menuItemProps, focusProps),
276+
className: styles.menuItemWrapper,
272277
};
273278

274279
if (isLink) {

0 commit comments

Comments
 (0)