diff --git a/.changeset/rotten-hats-wonder.md b/.changeset/rotten-hats-wonder.md new file mode 100644 index 00000000000..33f2325a497 --- /dev/null +++ b/.changeset/rotten-hats-wonder.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Updated PageLayout.Pane to conditionally include id prop diff --git a/src/PageLayout/PageLayout.tsx b/src/PageLayout/PageLayout.tsx index 54bd7f9e285..f06af5ff006 100644 --- a/src/PageLayout/PageLayout.tsx +++ b/src/PageLayout/PageLayout.tsx @@ -736,6 +736,7 @@ const Pane = React.forwardRef {resizable && ( diff --git a/src/SplitPageLayout/SplitPageLayout.stories.tsx b/src/SplitPageLayout/SplitPageLayout.stories.tsx index d3efd979e45..8926c6e7a18 100644 --- a/src/SplitPageLayout/SplitPageLayout.stories.tsx +++ b/src/SplitPageLayout/SplitPageLayout.stories.tsx @@ -159,6 +159,11 @@ const meta: Meta = { control: {type: 'radio'}, table: {category: 'Pane props'}, }, + 'Pane.id': { + type: 'string', + defaultValue: 'customId', + table: {category: 'Pane props'}, + }, 'Pane.position.narrow': { type: { name: 'enum', @@ -351,6 +356,7 @@ const Template: Story = args => ( regular: args['Pane.hidden.regular'], wide: args['Pane.hidden.wide'], }} + id={args['Pane.id']} > diff --git a/src/SplitPageLayout/SplitPageLayout.test.tsx b/src/SplitPageLayout/SplitPageLayout.test.tsx index b2b18058ce6..3a711dfce86 100644 --- a/src/SplitPageLayout/SplitPageLayout.test.tsx +++ b/src/SplitPageLayout/SplitPageLayout.test.tsx @@ -27,6 +27,21 @@ describe('SplitPageLayout', () => { , ) + expect(container).toMatchSnapshot() }) + + it('renders Pane with a custom ID', () => { + const {getByText} = render( + + + Pane Content + + , + ) + + const pane = getByText('Pane Content') + + expect(pane.getAttribute('id')).toBe('customId') + }) })