Skip to content

Commit 54ee453

Browse files
committed
remove href check for a
1 parent d1f1272 commit 54ee453

2 files changed

Lines changed: 1 addition & 9 deletions

File tree

packages/react/src/ActionList/Item.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,6 @@ const UnwrappedItem = <As extends React.ElementType = 'li'>(
149149
props.href || props.to || (typeof props.as === 'string' && props.as.toLowerCase() === 'a') || role === 'link',
150150
)
151151

152-
// Validate that anchor elements have href or to (unless inactive, which renders as span)
153-
if (typeof props.as === 'string' && props.as.toLowerCase() === 'a' && !inactiveText) {
154-
invariant(
155-
props.href || props.to,
156-
'ActionList.Item with as="a" must have an href or to prop for proper link semantics and accessibility.',
157-
)
158-
}
159-
160152
/** Infer item role based on the container */
161153
let inferredItemRole: ActionListItemProps['role']
162154
if (container === 'ActionMenu') {

packages/react/src/NavList/NavList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const Item = React.forwardRef<HTMLAnchorElement, NavListItemProps>(
9393
return (
9494
<ActionList.Item
9595
ref={ref}
96-
as={props.href ? 'a' : undefined}
96+
as={'a'}
9797
aria-current={ariaCurrent}
9898
active={Boolean(ariaCurrent) && ariaCurrent !== 'false'}
9999
style={{'--subitem-depth': depth} as React.CSSProperties}

0 commit comments

Comments
 (0)