Skip to content

Commit 25fec5a

Browse files
committed
fix: explicitly set content-box on unavailable icon in Menu
1 parent 835f0aa commit 25fec5a

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

packages/@adobe/spectrum-css-temp/components/menu/index.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ governing permissions and limitations under the License.
272272
}
273273
}
274274

275+
.spectrum-Menu-unavailableIcon {
276+
box-sizing: content-box;
277+
align-self: center;
278+
}
279+
275280
&.spectrum-Menu-wrapper--isMobile {
276281
width: 100%;
277282
border: none;

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import InfoOutline from '@spectrum-icons/workflow/InfoOutline';
2121
// @ts-ignore
2222
import intlMessages from '../intl/*.json';
2323
import {mergeRefs, useObjectRef, useSlotId} from '@react-aria/utils';
24-
import React, {useMemo, useRef} from 'react';
24+
import React, {cloneElement, useMemo, useRef} from 'react';
2525
import styles from '@adobe/spectrum-css-temp/components/menu/vars.css';
2626
import {Text} from '@react-spectrum/text';
2727
import {TreeState} from '@react-stately/tree';
@@ -96,6 +96,16 @@ export function MenuItem<T>(props: MenuItemProps<T>) {
9696
let contents = typeof rendered === 'string'
9797
? <Text>{rendered}</Text>
9898
: rendered;
99+
100+
let unavailableIcon = cloneElement(<InfoOutline />, {
101+
UNSAFE_className: classNames(
102+
styles,
103+
'spectrum-Menu-unavailableIcon'
104+
),
105+
slot: 'end',
106+
size: 'XS',
107+
'aria-label': stringFormatter.format('unavailable')
108+
});
99109

100110
return (
101111
<FocusRing focusRingClass={classNames(styles, 'focus-ring')}>
@@ -141,7 +151,7 @@ export function MenuItem<T>(props: MenuItemProps<T>) {
141151
} />
142152
}
143153
{
144-
isUnavailable && <InfoOutline slot="end" size="XS" alignSelf="center" aria-label={stringFormatter.format('unavailable')} />
154+
isUnavailable && unavailableIcon
145155
}
146156
{
147157
isUnavailable == null && isSubmenuTrigger && (direction === 'rtl' ? <ChevronLeft slot="chevron" /> : <ChevronRight slot="chevron" />)

0 commit comments

Comments
 (0)