Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

[terra-application-header-layout, terra-layout] Fix for the "Skip to content" button accessibility issue #2105

Merged
merged 5 commits into from
Mar 27, 2024
Merged
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
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Cerner Corporation
- Kol Kheang [@kolkheang]
- Aaron Johnson [@zxeleven]
- Serhii Pavlov [@sPavl0v]
- Dmytro Smoliakov [@user099]

[@tbiethman]: https://github.com/tbiethman
[@mjhenkes]: https://github.com/mjhenkes
Expand Down Expand Up @@ -103,3 +104,4 @@ Cerner Corporation
[@kolkheang]: https://github.com/kolkheang
[@zxeleven]: https://github.com/zxeleven
[@sPavl0v]: https://github.com/sPavl0v
[@user099]: https://github.com/user099
3 changes: 3 additions & 0 deletions packages/terra-application-header-layout/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Changed
* "Skip to content" button's logic that adds and removes `tabindex` attribute for the main element was removed to fix unexpected focus behavior for users using screen readers.

## 3.40.0 - (December 18, 2023)

* Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ const ApplicationHeaderLayout = ({
const mainContainer = document.querySelector(['[data-terra-layout-main]']);

if (mainContainer) {
mainContainer.setAttribute('tabindex', '-1');
mainContainer.focus();
mainContainer.removeAttribute('tabindex');
}
};

Expand Down
2 changes: 2 additions & 0 deletions packages/terra-layout/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## Unreleased
* Changed
* `tabindex` attribute with value `-1` was added to the main element (`data-terra-layout-main`) to fix unexpected focus behavior for users using screen readers.

## 4.39.0 - (December 18, 2023)

Expand Down
2 changes: 1 addition & 1 deletion packages/terra-layout/src/_LayoutSlidePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class LayoutSlidePanel extends React.Component {
</div>
<OverlayContainer className={cx('content')}>
<Overlay isRelativeToContainer onRequestClose={onToggle} isOpen={isOverlayOpen} backgroundStyle={overlayBackground} zIndex="6000" />
<main role="main" data-terra-layout-main className={cx('main-container')}>
<main role="main" tabIndex="-1" data-terra-layout-main className={cx('main-container')}>
{children}
</main>
</OverlayContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ exports[`LayoutSlidePanel correctly applies the theme context className 1`] = `
className="main-container"
data-terra-layout-main={true}
role="main"
tabIndex="-1"
/>
</div>
</div>
Expand Down Expand Up @@ -83,6 +84,7 @@ exports[`LayoutSlidePanel should render when small 1`] = `
className="main-container"
data-terra-layout-main={true}
role="main"
tabIndex="-1"
>
<div>
Child
Expand Down Expand Up @@ -121,6 +123,7 @@ exports[`LayoutSlidePanel should render when tiny 1`] = `
className="main-container"
data-terra-layout-main={true}
role="main"
tabIndex="-1"
>
<div>
Child
Expand Down Expand Up @@ -159,6 +162,7 @@ exports[`LayoutSlidePanel should render with provided props 1`] = `
className="main-container"
data-terra-layout-main={true}
role="main"
tabIndex="-1"
>
<div>
Child
Expand Down Expand Up @@ -192,6 +196,7 @@ exports[`LayoutSlidePanel should render without optional props 1`] = `
className="main-container"
data-terra-layout-main={true}
role="main"
tabIndex="-1"
/>
</OverlayContainer>
</div>
Expand Down
Loading