Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
PageLayout: Use HTML5 landmark elements#1973
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
89dabafdbc9f0b3d3511d6637d4f31f105ec30240e8106309File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@primer/react": patch | ||
| --- | ||
| The `PageLayout` component now renders [HTML5 landmark elements](https://web.dev/use-landmarks/) (`header`, `aside`, `footer`) to improve the navigation experience for people using assistive technologies (like screen readers) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -114,7 +114,6 @@ const HorizontalDivider: React.FC<DividerProps> = ({variant = 'none', variantWhe | ||
| const {padding} = React.useContext(PageLayoutContext) | ||
| return ( | ||
| <Box | ||
| role="separator" | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| sx={(theme: any) => | ||
| merge<BetterSystemStyleObject>( | ||
| @@ -156,7 +155,6 @@ const verticalDividerVariants = { | ||
| const VerticalDivider: React.FC<DividerProps> = ({variant = 'none', variantWhenNarrow = 'inherit', sx = {}}) => { | ||
| return ( | ||
| <Box | ||
| role="separator" | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| sx={(theme: any) => | ||
| merge<BetterSystemStyleObject>( | ||
| @@ -191,6 +189,7 @@ const Header: React.FC<PageLayoutHeaderProps> = ({ | ||
| const {rowGap} = React.useContext(PageLayoutContext) | ||
| return ( | ||
| <Box | ||
| as="header" | ||
| sx={merge<BetterSystemStyleObject>( | ||
| { | ||
| order: REGION_ORDER.header, | ||
| @@ -230,6 +229,7 @@ const contentWidths = { | ||
| const Content: React.FC<PageLayoutContentProps> = ({width = 'full', children, sx = {}}) => { | ||
| return ( | ||
| <Box | ||
| as="main" | ||
| sx={merge<BetterSystemStyleObject>( | ||
| { | ||
| order: REGION_ORDER.content, | ||
| @@ -286,6 +286,7 @@ const Pane: React.FC<PageLayoutPaneProps> = ({ | ||
| const computedDividerWhenNarrow = dividerWhenNarrow === 'inherit' ? divider : dividerWhenNarrow | ||
| return ( | ||
| <Box | ||
| as="aside" | ||
| ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| sx={(theme: any) => | ||
| merge<BetterSystemStyleObject>( | ||
| @@ -344,6 +345,7 @@ const Footer: React.FC<PageLayoutFooterProps> = ({ | ||
| const {rowGap} = React.useContext(PageLayoutContext) | ||
| return ( | ||
| <Box | ||
| as="footer" | ||
| sx={merge<BetterSystemStyleObject>( | ||
| { | ||
| order: REGION_ORDER.footer, | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh interesting, what does removing this do?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If doesn't have role= separator, should this have aria-hidden=true instead?
Made that exact change for ActionList.Divider: #1757
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good callout @siddharthkp. I believe my recommendation was to use both
role="presentation"andaria-hidden="true". @colebemis, I'll update the recommendation in the a11y review issue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary to do on a
divelement?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without adding
roleoraria-hidden, it like looks divider already does not appear in the accessibility tree:What do
roleandaria-hiddendo for us in this case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh because it's an empty div, it would probably just get "Ignored" in the tree