@@ -169,13 +169,11 @@ export let menuitem = style<Omit<MenuItemRenderProps, 'hasSubmenu' | 'isOpen'> &
169169 } ,
170170 color : {
171171 default : baseColor ( 'neutral' ) ,
172+ isDisabled : 'disabled' ,
172173 forcedColors : {
173174 default : 'ButtonText' ,
174- isFocused : 'HighlightText'
175- } ,
176- isDisabled : {
177- default : 'disabled' ,
178- forcedColors : 'GrayText'
175+ isFocused : 'HighlightText' ,
176+ isDisabled : 'GrayText'
179177 }
180178 } ,
181179 position : 'relative' ,
@@ -278,7 +276,7 @@ export let label = style<{size: string}>({
278276 marginTop : '--labelPadding'
279277} ) ;
280278
281- export let description = style ( {
279+ export let description = style < { size : 'S' | 'M' | 'L' | 'XL' , isFocused : boolean , isDisabled : boolean } > ( {
282280 gridArea : 'description' ,
283281 font : {
284282 default : 'ui-sm' ,
@@ -294,7 +292,10 @@ export let description = style({
294292 // Ideally this would use the same token as hover, but we don't have access to that here.
295293 // TODO: should we always consider isHovered and isFocused to be the same thing?
296294 isFocused : 'gray-800' ,
297- isDisabled : 'disabled'
295+ isDisabled : 'disabled' ,
296+ forcedColors : {
297+ default : 'inherit'
298+ }
298299 } ,
299300 transition : 'default'
300301} ) ;
@@ -304,7 +305,7 @@ let value = style({
304305 marginStart : 8
305306} ) ;
306307
307- let keyboard = style < { size : 'S' | 'M' | 'L' | 'XL' , isDisabled : boolean } > ( {
308+ let keyboard = style < { size : 'S' | 'M' | 'L' | 'XL' , isDisabled : boolean , isFocused : boolean } > ( {
308309 gridArea : 'keyboard' ,
309310 marginStart : 8 ,
310311 font : 'ui' ,
@@ -313,7 +314,7 @@ let keyboard = style<{size: 'S' | 'M' | 'L' | 'XL', isDisabled: boolean}>({
313314 default : 'gray-600' ,
314315 isDisabled : 'disabled' ,
315316 forcedColors : {
316- isDisabled : 'GrayText '
317+ default : 'inherit '
317318 }
318319 } ,
319320 unicodeBidi : 'plaintext'
@@ -386,7 +387,7 @@ export const Menu = /*#__PURE__*/ (forwardRef as forwardRefType)(function Menu<T
386387 } ] ,
387388 [ TextContext , {
388389 slots : {
389- 'description' : { styles : description ( { size} ) }
390+ 'description' : { styles : description ( { size, isFocused : false , isDisabled : false } ) }
390391 }
391392 } ] ,
392393 [ InPopoverContext , false ]
@@ -526,6 +527,7 @@ export function MenuItem(props: MenuItemProps): ReactNode {
526527 { ( renderProps ) => {
527528 let { children} = props ;
528529 let checkboxRenderProps = { ...renderProps , size, isFocused : false , isFocusVisible : false , isIndeterminate : false , isReadOnly : false , isInvalid : false , isRequired : false } ;
530+ let isFocused = ( renderProps . hasSubmenu && renderProps . isOpen ) || renderProps . isFocused ;
529531 return (
530532 < >
531533 < Provider
@@ -540,11 +542,11 @@ export function MenuItem(props: MenuItemProps): ReactNode {
540542 slots : {
541543 [ DEFAULT_SLOT ] : { styles : label ( { size} ) } ,
542544 label : { styles : label ( { size} ) } ,
543- description : { styles : description ( { ...renderProps , size} ) } ,
545+ description : { styles : description ( { ...renderProps , size, isFocused } ) } ,
544546 value : { styles : value }
545547 }
546548 } ] ,
547- [ KeyboardContext , { styles : keyboard ( { size, isDisabled : renderProps . isDisabled } ) } ] ,
549+ [ KeyboardContext , { styles : keyboard ( { ... renderProps , size, isFocused } ) } ] ,
548550 [ ImageContext , { styles : image ( { size} ) } ]
549551 ] } >
550552 { renderProps . selectionMode === 'single' && ! renderProps . hasSubmenu && < CheckmarkIcon size = { checkmarkIconSize [ size ] } className = { checkmark ( { ...renderProps , size} ) } /> }
0 commit comments