Skip to content

Commit 949e3c7

Browse files
crisbetoandrewseguin
authored andcommitted
fix(cdk/a11y): visually hidden element affecting scrolling (#24620)
We had a `position: absolute` on the visually-hidden element, but it didn't have an actual position which can cause unnecessary scrolling in some cases. Fixes #24597. (cherry picked from commit 38946e6)
1 parent 76737ec commit 949e3c7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/cdk/a11y/_index.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@
2121
// Avoid some cases where the browser will still render the native controls (see #9049).
2222
-webkit-appearance: none;
2323
-moz-appearance: none;
24+
25+
// We need at least one of top/bottom/left/right in order to prevent cases where the
26+
// absolute-positioned element is pushed down and can affect scrolling (see #24597).
27+
// `left` was chosen here, because it's the least likely to break overrides where the
28+
// element might have been positioned (e.g. `mat-checkbox`).
29+
left: 0;
30+
31+
[dir='rtl'] & {
32+
left: auto;
33+
right: 0;
34+
}
2435
}
2536
}
2637

0 commit comments

Comments
 (0)