Skip to content

Commit c72abae

Browse files
Merge branch 'main' into revert-select-panel
2 parents 37e4aa8 + e052644 commit c72abae

21 files changed

+1541
-181
lines changed

.changeset/clever-hotels-kneel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
Fixes the sx prop on the SegmentedControl buttons by properly merging the sx prop when cloning button children.

.changeset/large-trains-press.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': minor
3+
---
4+
5+
Adds a `size` prop to the SegmentedControl component. Users can choose between 'medium' (default), and 'small'. More sizes can be added when/if we find we need them.

.changeset/neat-squids-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Adds support for arrow key navigation of a TreeView using `aria-activedescendant`

.changeset/tidy-beans-punch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
Add a `current` prop to `TreeView.Item` and `TreeView.LinkItem`

.github/release_template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,8 @@ Please ensure these items are checked before merging.
2525
- [ ] No noticeable regressions have not been introduced as a result of changes in this release
2626
- [ ] Release notes accurately describe the changes made
2727

28+
### 🚢 After merge
29+
30+
- [ ] Add the preview deployment's link to releases as a way of permalinking to old version's docs. [Example](https://github.com/primer/react/releases/tag/v35.9.0)
31+
2832
Please also leave any testing notes as a comment on this pull request. In particular, describing any issues encountered during your testing. This is helpful in providing historical context to maintainers.

docs/content/PageLayout.mdx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,39 @@ Add `offsetHeader` prop to specify the height of the custom sticky header along
202202
</Box>
203203
```
204204

205+
### With `NavList`
206+
207+
`PageLayout.Pane` by itself does not specify or provide landmark roles. Using
208+
components that define their own landmark roles, such as [`NavList`](/NavList), will provide
209+
clear structure to the page that is not present by default in `PageLayout.Pane`.
210+
211+
It's important to note that multiple landmark roles, such as multiple
212+
`<nav>` elements, should be uniquely labelled in order to clarify what the
213+
navigation container is used for.
214+
215+
```jsx live
216+
<PageLayout>
217+
<PageLayout.Header>
218+
<Placeholder label="Header" height={64} />
219+
</PageLayout.Header>
220+
<PageLayout.Pane position="start" aria-label="Secondary navigation">
221+
<NavList>
222+
<NavList.Item href="/" aria-current="page">
223+
Home
224+
</NavList.Item>
225+
<NavList.Item href="/about">About</NavList.Item>
226+
<NavList.Item href="/contact">Contact</NavList.Item>
227+
</NavList>
228+
</PageLayout.Pane>
229+
<PageLayout.Content>
230+
<Placeholder label="Content" height={240} />
231+
</PageLayout.Content>
232+
<PageLayout.Footer>
233+
<Placeholder label="Footer" height={64} />
234+
</PageLayout.Footer>
235+
</PageLayout>
236+
```
237+
205238
### With `aria-label`
206239

207240
Using `aria-label` along with `PageLayout.Header`, `PageLayout.Content`, or `PageLayout.Footer` creates a unique label for that landmark role that can make it easier to navigate between sections of content on a page.
@@ -262,6 +295,20 @@ Each component may be labeled through either `aria-label` or `aria-labelledby` i
262295
- [WCAG, ARIA11 Technique](https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA11)
263296
- [MDN, Landmark roles](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/landmark_role)
264297

298+
### `PageLayout.Pane`
299+
300+
The `PageLayout.Pane` component does not provide a default landmark role as the
301+
content of this component may have different roles. When using this component,
302+
consider the type of content being rendered inside of `PageLayout.Pane` and if
303+
it requires a landmark role. Common landmark roles include:
304+
305+
- [`aside`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside)
306+
- [`navigation`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside)
307+
308+
Some components, such as `NavList` may already include a landmark role. In these
309+
situation, these components use an appropriate landmark role and no further
310+
action is needed when using `PageLayout.Pane`.
311+
265312
### Screen readers
266313

267314
Most screen readers provide a mechanism through which you can navigate between landmarks on the page. Typically, this is done through a specific keyboard shortcut or through an option in a rotor.

docs/content/SegmentedControl.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ const Controlled = () => {
3939
render(Controlled)
4040
```
4141

42+
### Small
43+
44+
```jsx live
45+
<SegmentedControl aria-label="File view" size="small">
46+
<SegmentedControl.Button defaultSelected>Preview</SegmentedControl.Button>
47+
<SegmentedControl.Button>Raw</SegmentedControl.Button>
48+
<SegmentedControl.Button>Blame</SegmentedControl.Button>
49+
</SegmentedControl>
50+
```
51+
4252
### With icons and labels
4353

4454
```jsx live
@@ -210,6 +220,7 @@ render(Controlled)
210220
type="boolean"
211221
description="Whether the segment is selected. This is used for controlled SegmentedControls, and needs to be updated using the onChange handler on SegmentedControl."
212222
/>
223+
<PropsTableRow name="selected" type="'small' | 'medium'" description="The size of the buttons" />
213224
<PropsTableRow
214225
name="defaultSelected"
215226
type="boolean"

docs/content/TreeView.mdx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ description: A hierarchical list of items where nested items can be expanded and
1919
<TreeView.Item>
2020
Button
2121
<TreeView.SubTree>
22-
<TreeView.LinkItem href="#">Button.tsx</TreeView.LinkItem>
22+
<TreeView.LinkItem href="#" current>
23+
Button.tsx
24+
</TreeView.LinkItem>
2325
<TreeView.LinkItem href="#">Button.test.tsx</TreeView.LinkItem>
2426
</TreeView.SubTree>
2527
</TreeView.Item>
@@ -46,7 +48,7 @@ description: A hierarchical list of items where nested items can be expanded and
4648
src
4749
<TreeView.SubTree>
4850
<TreeView.LinkItem href="#">Avatar.tsx</TreeView.LinkItem>
49-
<TreeView.LinkItem href="#">
51+
<TreeView.LinkItem href="#" current>
5052
Button
5153
<TreeView.SubTree>
5254
<TreeView.LinkItem href="#">Button.tsx</TreeView.LinkItem>
@@ -80,6 +82,13 @@ description: A hierarchical list of items where nested items can be expanded and
8082

8183
<PropsTable>
8284
<PropsTableRow name="children" type="React.ReactNode" required />
85+
<PropsTable
86+
name="current"
87+
type="boolean"
88+
defaultValue="false"
89+
description="Whether the item is the current item. No more than one item should be current at once."
90+
/>
91+
<PropsTableRow name="defaultExpanded" type="boolean" description="Whether the item is expanded by default." />
8392
<PropsTableRow
8493
name="onSelect"
8594
type="(event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void"

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/PageLayout/PageLayout.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ export const CustomStickyHeader: Story = args => (
602602
// a box to create a sticky top element that will be on the consumer side and outside of the PageLayout component
603603
<Box data-testid="story-window">
604604
<Box
605+
as="header"
605606
data-testid="sticky-header"
606607
sx={{
607608
position: 'sticky',

0 commit comments

Comments
 (0)