Skip to content

Commit

Permalink
[euiScreenReaderOnly] Use clip to fix scrolling issues caused by ab…
Browse files Browse the repository at this point in the history
…solute positioning (elastic#5130)

* Update .euiScreenReaderOnly to use clip

- this prevents issues with absolute positioning and scrolling containers, and works on all modern browsers supported by EUI

* Add changelog entry

* [PR feedback] Add comment with more context
  • Loading branch information
Constance authored Sep 2, 2021
1 parent dc7b70d commit bca85fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `37.6.0`.
**Bug fixes**

- Fixed `EuiScreenReaderOnly` positioning issues within scrolling containers ([#5130](https://github.com/elastic/eui/pull/5130))

## [`37.6.0`](https://github.com/elastic/eui/tree/v37.6.0)

Expand Down
5 changes: 5 additions & 0 deletions src/global_styling/mixins/_helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,15 @@
}

// Hiding elements offscreen to only be read by screen reader
// NOTE: Hidden absolute positioning can cause issues with scrolling/overflow.
// `clip` and `left` (for Chromium browsers) are needed to prevent these issues -
// @see https://github.com/elastic/eui/pull/5130 for more info
@mixin euiScreenReaderOnly {
position: absolute;
left: -10000px;
top: auto;
clip: rect(0 0 0 0);
clip-path: inset(50%);
width: 1px;
height: 1px;
overflow: hidden;
Expand Down

0 comments on commit bca85fb

Please sign in to comment.