Skip to content

Commit 33aafec

Browse files
authored
Remove extra div wrapper from menu unavailable (#4666)
1 parent e892f4b commit 33aafec

File tree

2 files changed

+31
-37
lines changed

2 files changed

+31
-37
lines changed

packages/@react-spectrum/menu/src/Menu.tsx

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,45 +39,44 @@ function Menu<T extends object>(props: SpectrumMenuProps<T>, ref: DOMRef<HTMLULi
3939
return (
4040
<MenuStateContext.Provider value={{state, container: scopedRef, menu: domRef}}>
4141
<FocusScope contain={state.expandedKeys.size > 0}>
42-
<div ref={scopedRef} style={{display: 'inline-flex', overflow: 'hidden'}}>
43-
<ul
44-
{...menuProps}
45-
{...styleProps}
46-
ref={domRef}
47-
className={
48-
classNames(
49-
styles,
50-
'spectrum-Menu',
51-
styleProps.className
52-
)
53-
}>
54-
{[...state.collection].map(item => {
55-
if (item.type === 'section') {
56-
return (
57-
<MenuSection
58-
key={item.key}
59-
item={item}
60-
state={state}
61-
onAction={completeProps.onAction} />
62-
);
63-
}
64-
65-
let menuItem = (
66-
<MenuItem
42+
<ul
43+
{...menuProps}
44+
{...styleProps}
45+
ref={domRef}
46+
className={
47+
classNames(
48+
styles,
49+
'spectrum-Menu',
50+
styleProps.className
51+
)
52+
}>
53+
{[...state.collection].map(item => {
54+
if (item.type === 'section') {
55+
return (
56+
<MenuSection
6757
key={item.key}
6858
item={item}
6959
state={state}
7060
onAction={completeProps.onAction} />
7161
);
62+
}
63+
64+
let menuItem = (
65+
<MenuItem
66+
key={item.key}
67+
item={item}
68+
state={state}
69+
onAction={completeProps.onAction} />
70+
);
7271

73-
if (item.wrapper) {
74-
menuItem = item.wrapper(menuItem);
75-
}
72+
if (item.wrapper) {
73+
menuItem = item.wrapper(menuItem);
74+
}
7675

77-
return menuItem;
78-
})}
79-
</ul>
80-
</div>
76+
return menuItem;
77+
})}
78+
</ul>
79+
<div ref={scopedRef} />
8180
</FocusScope>
8281
</MenuStateContext.Provider>
8382
);

packages/@react-stately/flags/src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,8 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
export let unavailableMenuItems = false;
1413
export let tableNestedRows = false;
1514

16-
export function enableUnavailableMenuItems() {
17-
unavailableMenuItems = true;
18-
}
19-
2015
export function enableTableNestedRows() {
2116
tableNestedRows = true;
2217
}

0 commit comments

Comments
 (0)