Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/react-compiler-tooltip-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Tooltip: Improve rendering performance with React Compiler support
1 change: 0 additions & 1 deletion packages/react/script/react-compiler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const unsupportedPatterns = [
'src/hooks/useScrollFlash.ts',
'src/internal/components/CheckboxOrRadioGroup/**/*.tsx',
'src/hooks/useMergedRefs.ts',
'src/TooltipV2/**/*.tsx',
]

const unsupported = new Set(
Expand Down
35 changes: 21 additions & 14 deletions packages/react/src/TooltipV2/__tests__/Tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ const TooltipComponentWithExistingDescription = (props: Omit<TooltipProps, 'text
</>
)

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function ExampleWithActionMenu(actionMenuTrigger: React.ReactElement<any>): JSX.Element {
interface ExampleWithActionMenuProps {
actionMenuTrigger: React.ReactElement
}

function ExampleWithActionMenu({actionMenuTrigger}: ExampleWithActionMenuProps): JSX.Element {
return (
<BaseStyles>
<ActionMenu>
Expand Down Expand Up @@ -82,11 +85,13 @@ describe('Tooltip', () => {

it('should spread the accessibility attributes correctly on the trigger (ActionMenu.Button) when tooltip is used in an action menu', () => {
const {getByRole, getByText} = HTMLRender(
ExampleWithActionMenu(
<Tooltip text="Additional context about the menu button">
<ActionMenu.Button>Toggle Menu</ActionMenu.Button>
</Tooltip>,
),
<ExampleWithActionMenu
actionMenuTrigger={
<Tooltip text="Additional context about the menu button">
<ActionMenu.Button>Toggle Menu</ActionMenu.Button>
</Tooltip>
}
/>,
)
const menuButton = getByRole('button')
const tooltip = getByText('Additional context about the menu button')
Expand All @@ -96,13 +101,15 @@ describe('Tooltip', () => {

it('should spread the accessibility attributes correctly on the trigger (Button) when tooltip is used in an action menu', () => {
const {getByRole, getByText} = HTMLRender(
ExampleWithActionMenu(
<ActionMenu.Anchor>
<Tooltip text="Additional context about the menu button">
<Button>Toggle Menu</Button>
</Tooltip>
</ActionMenu.Anchor>,
),
<ExampleWithActionMenu
actionMenuTrigger={
<ActionMenu.Anchor>
<Tooltip text="Additional context about the menu button">
<Button>Toggle Menu</Button>
</Tooltip>
</ActionMenu.Anchor>
}
/>,
)
const menuButton = getByRole('button')
const tooltip = getByText('Additional context about the menu button')
Expand Down
Loading