Skip to content

Commit

Permalink
Prevent Tabs and ScrollView from unwanted cross-axis scrolling du…
Browse files Browse the repository at this point in the history
…ring keyboard navigation #499

Use the `clip` value for `overflow` to prevent the content from unwanted
scrolling on the cross axis during keyboard navigation.
  • Loading branch information
adamkudrna committed Feb 28, 2024
1 parent e6fdd20 commit 554c749
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/components/ScrollView/ScrollView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
//
// 7. Hide content overflowing in the other direction because scrollbars would be unreachable under
// scrolling shadows.
//
// 8. Use the `clip` value for `overflow` to prevent the content from unwanted scrolling on the
// cross axis during keyboard navigation.

@use "../../styles/tools/accessibility";
@use "../../styles/tools/caret";
Expand Down Expand Up @@ -99,7 +102,7 @@ $_arrow-outer-spacing: spacing.of(4);

.isRootVertical .viewport {
height: 100%;
overflow-x: hidden; // 7.
overflow-x: clip; // 7., 8.
overflow-y: auto; // 2.
}

Expand Down Expand Up @@ -180,13 +183,14 @@ $_arrow-outer-spacing: spacing.of(4);

.isRootHorizontal .viewport {
overflow-x: auto; // 2.
overflow-y: hidden; // 5., 7.
overflow-y: clip; // 5., 7., 8.
}

.isRootHorizontal .content {
display: inline-flex; // 4.
min-width: 100%;
vertical-align: top;
overflow: clip; // 8.
}

.isRootHorizontal .scrollingShadows::before,
Expand Down
7 changes: 4 additions & 3 deletions src/components/Tabs/Tabs.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// 1. Decorative bottom border.
// 1. Use the `clip` value to prevent the content from unwanted vertical scrolling during keyboard navigation.
// 2. Decorative bottom border.

@use "../../styles/tools/reset";
@use "theme";
Expand All @@ -11,10 +12,10 @@
min-width: 100%;
padding-right: theme.$padding-x;
padding-left: theme.$padding-x;
overflow-y: hidden;
overflow-y: clip; // 1.
white-space: nowrap;

// 1.
// 2.
&::after {
content: "";
position: absolute;
Expand Down

0 comments on commit 554c749

Please sign in to comment.