@@ -33,15 +33,6 @@ type MenuItemProps = {
3333 isSelected ?: boolean ;
3434} ;
3535
36- /**
37- * [1] For a disabled link to be valid, it must have:
38- * - `aria-disabled="true"`
39- * - `role="link"`, or `role="menuitem"` if within a menu
40- * - an `undefined` `href`
41- *
42- * @example <a role="link" aria-disabled="true">Learn something!</a>
43- * @see https://www.scottohara.me/blog/2021/05/28/disabled-links.html
44- */
4536const Item = ( { item, getItemProps, focusedValue, isSelected } : MenuItemProps ) => {
4637 const itemProps = getItemProps ( { item } ) ;
4738
@@ -63,13 +54,12 @@ const Item = ({ item, getItemProps, focusedValue, isSelected }: MenuItemProps) =
6354 'cursor-pointer' : ! item . disabled ,
6455 'cursor-default' : item . disabled
6556 } ) }
66- role = { itemProps . href ? 'none' : undefined }
67- { ...( ! itemProps . href && ( itemProps as LiHTMLAttributes < HTMLLIElement > ) ) }
57+ role = { item . href ? 'none' : undefined }
58+ { ...( ! item . href && ( itemProps as LiHTMLAttributes < HTMLLIElement > ) ) }
6859 >
69- { itemProps . href ? (
60+ { item . href ? (
7061 < a
7162 { ...( itemProps as AnchorHTMLAttributes < HTMLAnchorElement > ) }
72- href = { item . disabled ? undefined : itemProps . href }
7363 className = { classNames (
7464 ' w-full rounded-sm outline-offset-0 transition-none border-width-none' ,
7565 {
@@ -79,7 +69,7 @@ const Item = ({ item, getItemProps, focusedValue, isSelected }: MenuItemProps) =
7969 ) }
8070 >
8171 { itemChildren }
82- { ! ! item . isExternal && (
72+ { ! ! item . external && (
8373 < >
8474 < span aria-hidden = "true" > ↗</ span >
8575 < span className = "sr-only" > (opens in new window)</ span >
0 commit comments