Skip to content

Commit bca85fb

Browse files
author
Constance
authored
[euiScreenReaderOnly] Use clip to fix scrolling issues caused by absolute positioning (#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
1 parent dc7b70d commit bca85fb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## [`master`](https://github.com/elastic/eui/tree/master)
22

3-
No public interface changes since `37.6.0`.
3+
**Bug fixes**
4+
5+
- Fixed `EuiScreenReaderOnly` positioning issues within scrolling containers ([#5130](https://github.com/elastic/eui/pull/5130))
46

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

src/global_styling/mixins/_helpers.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,15 @@
106106
}
107107

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

0 commit comments

Comments
 (0)