Skip to content

Commit 07bc3b4

Browse files
authored
fix(s2): tab takes up entire popover width in collapsed tabs (#8441)
* fix(s2): tab takes up entire popover width in collasped tabs * add chromatic story with collapse behavior
1 parent f0e5369 commit 07bc3b4

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

packages/@react-spectrum/s2/chromatic/Tabs.stories.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {Meta} from '@storybook/react';
1717
import {style} from '../style/spectrum-theme' with { type: 'macro' };
1818
import {Tab, TabList, TabPanel, Tabs} from '../src/Tabs';
1919
import {Text} from '@react-spectrum/s2';
20+
import {userEvent} from '@storybook/test';
2021

2122
const meta: Meta<typeof Tabs> = {
2223
component: Tabs,
@@ -97,3 +98,28 @@ export const Icons = {
9798
</Tabs>
9899
)
99100
};
101+
102+
export const Collasped = {
103+
render: (args: any) => (
104+
<Tabs {...args} aria-label="Settings" styles={style({width: 200, height: 144})}>
105+
<TabList>
106+
<Tab id="Mouse">Mouse settings</Tab>
107+
<Tab id="Keyboard">Keyboard settings</Tab>
108+
<Tab id="Gamepad">Gamepad settings</Tab>
109+
</TabList>
110+
<TabPanel id="Mouse">
111+
Adjust the sensitivity and speed of your mouse
112+
</TabPanel>
113+
<TabPanel id="Keyboard">
114+
Customize the layout and function of your keyboard.
115+
</TabPanel>
116+
<TabPanel id="Gamepad">
117+
Configure the buttons and triggers on your gamepad.
118+
</TabPanel>
119+
</Tabs>
120+
),
121+
play: async () => {
122+
await userEvent.tab();
123+
await userEvent.keyboard('{Enter}');
124+
}
125+
};

packages/@react-spectrum/s2/src/TabsPicker.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export let menu = style({
127127
display: 'grid',
128128
gridTemplateColumns: [edgeToText(32), 'auto', 'auto', 'minmax(0, 1fr)', 'auto', 'auto', 'auto', edgeToText(32)],
129129
boxSizing: 'border-box',
130+
width: 'full',
130131
maxHeight: 'inherit',
131132
overflow: 'auto',
132133
padding: 8,

0 commit comments

Comments
 (0)