Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageHeader: Address dom order issues (screen reader experience feedback from sign-off) #4358

Merged
merged 25 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
77728e4
Update layout styles so that all interactive elements come after the …
broccolinisoup Mar 6, 2024
9ba6d27
Add PageHeder.Breadcrumbs sub component
broccolinisoup Mar 6, 2024
cc0481b
remove shapshot check on jest
broccolinisoup Mar 6, 2024
7fcea90
test(vrt): update snapshots
broccolinisoup Mar 6, 2024
b56d331
Merge branch 'main' into pageheader-sign-off-review-address
broccolinisoup Mar 27, 2024
62ae642
test(vrt): update snapshots
broccolinisoup Mar 27, 2024
3d701d7
make the interactive element in the heading check a warning not error
broccolinisoup Mar 27, 2024
e1bc42d
Merge branch 'main' into pageheader-sign-off-review-address
broccolinisoup Apr 19, 2024
621482d
add pageheader story for screen reader tes
broccolinisoup Apr 19, 2024
3ad5339
add links
broccolinisoup Apr 22, 2024
5fbee68
Merge branch 'main' into pageheader-sign-off-review-address
broccolinisoup Apr 28, 2024
61946d1
add onclick events to the buttons
broccolinisoup Apr 28, 2024
98b2e88
add a placeholder for file content example
broccolinisoup Apr 29, 2024
44bd6d8
Merge branch 'main' into pageheader-sign-off-review-address
broccolinisoup May 7, 2024
9d7b8e8
test(vrt): update snapshots
broccolinisoup May 7, 2024
5b82778
Merge branch 'main' into pageheader-sign-off-review-address
broccolinisoup May 8, 2024
b2d9692
elements losing context when viewport is narrrow - keep the same text…
broccolinisoup May 8, 2024
207b1a7
fix linting
broccolinisoup May 8, 2024
17a75a3
test(vrt): update snapshots
broccolinisoup May 9, 2024
0bd22ee
hide the overflow menu in narrow since we show it on the context area
broccolinisoup May 10, 2024
e74f862
accomodate different format sx prop for font size
broccolinisoup May 17, 2024
b34b7db
when no fontsize is specified css var returns as an empty string so n…
broccolinisoup May 17, 2024
8ed41bf
Merge branch 'main' into pageheader-sign-off-review-address
broccolinisoup May 17, 2024
5c24dab
temporary fix on navlist
broccolinisoup May 17, 2024
7bb732d
Merge branch 'main' into pageheader-sign-off-review-address
broccolinisoup May 23, 2024
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
7 changes: 7 additions & 0 deletions .changeset/clever-schools-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@primer/react': minor
---

PageHeader: Update the layout styles so that all interactive content comes after the title (while keeping the component visually the same)
This is a breaking change however PageHeader is still a draft component so we are releasing the changes as minor but please upgrade with caution.
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions e2e/components/PageHeader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,38 @@ test.describe('PageHeader', () => {
})
}
})

test.describe('Large Variant with Multiline Title', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'drafts-components-pageheader-devonly--large-variant-with-multiline-title',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`PageHeader.Large Variant with Multiline Title.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'drafts-components-pageheader-devonly--large-variant-with-multiline-title',
globals: {
colorScheme: theme,
},
})
await expect(page).toHaveNoViolations({
rules: {
'color-contrast': {
enabled: theme !== 'dark_dimmed',
},
},
})
})
})
}
})
})
95 changes: 95 additions & 0 deletions packages/react/src/PageHeader/PageHeader.dev.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React from 'react'
import type {Meta} from '@storybook/react'
import {Button, IconButton, Box} from '..'
import Label from '../Label'
import {GitBranchIcon, PencilIcon, SidebarExpandIcon} from '@primer/octicons-react'

import {PageHeader} from './PageHeader'

const meta: Meta<typeof PageHeader> = {
title: 'Drafts/Components/PageHeader/DevOnly',
parameters: {
layout: 'fullscreen',
controls: {expanded: true},
},
}

export default meta

export const LargeVariantWithMultilineTitle = () => (
<Box sx={{padding: 3}}>
<PageHeader>
<PageHeader.LeadingAction>
<IconButton aria-label="Edit" icon={PencilIcon} variant="invisible" />
</PageHeader.LeadingAction>
<PageHeader.TitleArea variant="large">
<PageHeader.LeadingVisual>
<GitBranchIcon />
</PageHeader.LeadingVisual>
<PageHeader.Title>
Title long title some extra loooong looong words here some extra loooong looong words here some extra loooong
looong words here some extra loooong looong words here some extra loooong looong words here
</PageHeader.Title>
<PageHeader.TrailingVisual>
<Label>Beta</Label>
</PageHeader.TrailingVisual>
</PageHeader.TitleArea>
<PageHeader.TrailingAction>
<IconButton aria-label="Expand sidebar" icon={SidebarExpandIcon} variant="invisible" />
</PageHeader.TrailingAction>
<PageHeader.Actions>
<Button variant="primary">Add Item</Button>
</PageHeader.Actions>
</PageHeader>
</Box>
)

export const ArrayTypeFontSizeOnTitle = () => (
<Box sx={{padding: 3}}>
<PageHeader>
<PageHeader.TitleArea>
<PageHeader.Title
sx={{
lineHeight: '1.25',
fontWeight: 'normal',
fontSize: ['26px', '26px', 'var(--text-title-size-large, 32px)', 'var(--text-title-size-large, 32px)'], // it doesn't support this format right now.
}}
>
Issue Title
</PageHeader.Title>
</PageHeader.TitleArea>
</PageHeader>
</Box>
)

export const ThemeBaseFontSizeOnTitle = () => (
<Box sx={{padding: 3}}>
<PageHeader>
<PageHeader.TitleArea>
<PageHeader.Title
sx={{
fontSize: 8,
}}
>
Issue Title
</PageHeader.Title>
</PageHeader.TitleArea>
</PageHeader>
</Box>
)

export const StringTypeFontSizeOnTitle = () => (
<Box sx={{padding: 3}}>
<PageHeader>
<PageHeader.TitleArea>
<PageHeader.Title
sx={{
fontSize: '56px',
}}
>
Issue Title
</PageHeader.Title>
</PageHeader.TitleArea>
</PageHeader>
</Box>
)
Loading
Loading