Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
"type": "boolean",
"defaultValue": "false",
"description": "Loading state for all counters. It displays loading animation for individual counters until all are resolved. It is needed to prevent multiple layout shift."
},
{
"name": "as",
"type": "React.ElementType",
"defaultValue": "'div'",
"description": "The HTML element or React component used to render the outermost element."
}
],
"subcomponents": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export type UnderlinePanelsProps = {
* Class name for custom styling
*/
className?: string
/**
* Element type for the tab container
*/
as?: React.ElementType
}

export type TabProps = PropsWithChildren<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type UnderlineWrapperProps<As extends React.ElementType> = {
}

export const UnderlineWrapper = forwardRef((props, ref) => {
const {children, className, as: Component = 'nav', ...rest} = props
const {children, className, as: Component = 'div', ...rest} = props

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default element from 'nav' to 'div' is a breaking change that affects semantic HTML structure. The UnderlineNav component relies on this default to render as a

element, which is critical for accessibility. The test at line 67 in UnderlineNav.test.tsx expects a element, and tests at lines 68, 74, and 125 use getByRole('navigation') which will fail with this change. UnderlineNav explicitly passes as='nav' (line 144 in UnderlineNav.tsx), so this change should not break functionality, but the change removes semantic meaning from UnderlinePanels which doesn't pass an 'as' prop. Consider if this is intentional or if the default should remain 'nav' with UnderlinePanels explicitly passing as='div' if needed.

Suggested change
const {children, className, as: Component = 'div', ...rest} = props
const {children, className, as: Component = 'nav', ...rest} = props

Copilot uses AI. Check for mistakes.
return (
<Component
className={clsx(classes.UnderlineWrapper, className)}
Expand Down
Loading