Skip to content

Commit 09b2ae0

Browse files
devversionmmalerba
authored andcommitted
fix(cdk/platform): rtl scroll axis incorrectly determined in Safari macOS (#19830)
In Safari on macOS, the RTL scroll axis is determined incorrectly when scrollbars are set to `Always Display` as per macOS general system preferences. Our test element for the scroll axis sets a fixed height. This is resulting in a vertical scroll bar as the horizontal scroll bar for testing `scrollLeft` exceeds the scroll containers `1px` height. The vertical scroll bar then unveils a bug in Webkit where space is acquired on the right side for the scroll bar (while it's displayed on the left). This space causes our scroll axis detection to break as the horizontal `scrollLeft` unexpectedly expands to: `[-scrollWidth, 15px]` while usually `0px` is the right boundary. We fix this by simply ensuring that no vertical scroll bar is ever displayed. The vertical scrolling is not needed for determining the RTL horizontal scroll axis type. I've reported a bug upstream in Webkit: https://bugs.webkit.org/show_bug.cgi?id=213851. Fixes #14609.
1 parent a34e6bb commit 09b2ae0

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/cdk/platform/features/scrolling.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export function getRtlScrollAxisType(): RtlScrollAxisType {
4848
const scrollContainer = document.createElement('div');
4949
const containerStyle = scrollContainer.style;
5050
scrollContainer.dir = 'rtl';
51-
containerStyle.height = '1px';
5251
containerStyle.width = '1px';
5352
containerStyle.overflow = 'auto';
5453
containerStyle.visibility = 'hidden';

0 commit comments

Comments
 (0)