Skip to content

Commit 3979742

Browse files
authored
feat(chore): prevent overscrolling
On mobile devices when scrolling inside a dropdown menu, scrolling table, segment, container, etc. reaching the top of the scrolling area, the browsers will reload the page "pull to refresh". This PR prevents such behavior on selected components, where an accidental refresh shouldnt be wanted.
1 parent 8a8d841 commit 3979742

File tree

12 files changed

+37
-34
lines changed

12 files changed

+37
-34
lines changed

src/definitions/collections/table.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@
399399
.ui.scrolling.table > tbody {
400400
display: block;
401401
overflow-y: scroll;
402+
overscroll-behavior: @overscrollBehavior;
402403
scrollbar-width: thin; /* Firefox */
403404
& > tr {
404405
display: table;
@@ -498,6 +499,7 @@
498499
.ui.overflowing.table {
499500
display: block;
500501
overflow: auto;
502+
overscroll-behavior: @overscrollBehavior;
501503
}
502504
@media only screen and (min-width: @tabletBreakpoint) {
503505
& when (@variationTableOverflowingShort) {

src/definitions/elements/container.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
---------------*/
190190
.ui.scrolling.container {
191191
overflow: auto;
192+
overscroll-behavior: @overscrollBehavior;
192193
}
193194
@media only screen and (max-width : @largestMobileScreen) {
194195
& when (@variationContainerScrollingShort) {

src/definitions/elements/segment.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@
793793
---------------*/
794794
.ui.scrolling.segment {
795795
overflow: auto;
796+
overscroll-behavior: @overscrollBehavior;
796797
}
797798
@media only screen and (max-width : @largestMobileScreen) {
798799
& when (@variationSegmentScrollingShort) {

src/definitions/modules/dropdown.less

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ select.ui.dropdown {
448448
.ui.selection.dropdown .menu {
449449
overflow-x: hidden;
450450
overflow-y: auto;
451+
overscroll-behavior: @overscrollBehavior;
451452
backface-visibility: hidden;
452453
-webkit-overflow-scrolling: touch;
453454
border-top-width: 0 !important;
@@ -765,6 +766,7 @@ select.ui.dropdown {
765766
.ui.search.dropdown .menu {
766767
overflow-x: hidden;
767768
overflow-y: auto;
769+
overscroll-behavior: @overscrollBehavior;
768770
backface-visibility: hidden;
769771
-webkit-overflow-scrolling: touch;
770772
}
@@ -1319,11 +1321,7 @@ select.ui.dropdown {
13191321
.ui.dropdown .scrolling.menu {
13201322
overflow-x: hidden;
13211323
overflow-y: auto;
1322-
}
1323-
1324-
.ui.scrolling.dropdown .menu {
1325-
overflow-x: hidden;
1326-
overflow-y: auto;
1324+
overscroll-behavior: @overscrollBehavior;
13271325
backface-visibility: hidden;
13281326
-webkit-overflow-scrolling: touch;
13291327
min-width: 100% !important;
@@ -1332,13 +1330,10 @@ select.ui.dropdown {
13321330

13331331
.ui.dropdown .scrolling.menu {
13341332
position: static;
1335-
overflow-y: auto;
13361333
border: none;
13371334
box-shadow: none !important;
13381335
border-radius: 0 0 @floatingMenuBorderRadius @floatingMenuBorderRadius !important;
13391336
margin: 0 !important;
1340-
min-width: 100% !important;
1341-
width: auto !important;
13421337
border-top: @menuBorder;
13431338
}
13441339
.ui.scrolling.dropdown .menu .item.item.item,
@@ -1500,6 +1495,7 @@ select.ui.dropdown {
15001495
.ui.simple.selection.dropdown > .menu > .item:active > .menu,
15011496
.ui.simple.selection.dropdown .menu .item:hover > .menu {
15021497
overflow: auto;
1498+
overscroll-behavior: @overscrollBehavior;
15031499
}
15041500
}
15051501
.ui.simple.dropdown > .menu > .item:active > .left.menu,
@@ -1528,6 +1524,7 @@ select.ui.dropdown {
15281524
.ui.simple.scrolling.dropdown:hover > .menu {
15291525
overflow-x: hidden;
15301526
overflow-y: auto;
1527+
overscroll-behavior: @overscrollBehavior;
15311528
}
15321529
}
15331530
}

src/definitions/modules/flyout.less

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,25 @@
100100
line-height: @contentLineHeight;
101101
padding: @contentPadding;
102102
background: @contentBackground;
103+
&.scrolling when(@variationFlyoutScrolling) {
104+
overflow: auto;
105+
overscroll-behavior: @overscrollBehavior;
106+
}
103107
}
104108
.ui.flyout.left > .content,
105109
.ui.flyout.right > .content {
106110
min-height: @contentMinHeight;
107111
}
112+
& when(@variationFlyoutScrolling) {
113+
.ui.flyout.left > .scrolling.content,
114+
.ui.flyout.right > .scrolling.content {
115+
max-height: @scrollingContentMaxHeight;
116+
}
108117

109-
.ui.flyout.left > .scrolling.content,
110-
.ui.flyout.right > .scrolling.content{
111-
max-height: @scrollingContentMaxHeight;
112-
overflow: auto;
113-
}
114-
115-
.ui.flyout.top > .scrolling.content,
116-
.ui.flyout.bottom > .scrolling.content{
117-
max-height: @scrollingContentMaxHeightTopBottom;
118-
overflow: auto;
118+
.ui.flyout.top > .scrolling.content,
119+
.ui.flyout.bottom > .scrolling.content {
120+
max-height: @scrollingContentMaxHeightTopBottom;
121+
}
119122
}
120123

121124
& when (@variationFlyoutActions) {
@@ -520,7 +523,7 @@ body.pushable > .pusher {
520523
--------------------*/
521524

522525
& when (@variationFlyoutColumnWidth) {
523-
526+
524527
/* Sizing Combinations */
525528

526529
.ui[class*="one wide"].flyout:not(.fullscreen) {
@@ -637,7 +640,7 @@ body.pushable > .pusher {
637640
.ui.visible.overlay.flyout {
638641
transform: translate3d(0%, 0, 0);
639642
}
640-
643+
641644
/* End - Pusher */
642645
.ui.visible.overlay.flyout ~ .fixed,
643646
.ui.visible.overlay.flyout ~ .pusher {

src/definitions/modules/modal.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@
453453
}
454454
.scrolling.dimmable.dimmed > .dimmer {
455455
overflow: auto;
456+
overscroll-behavior: @overscrollBehavior;
456457
-webkit-overflow-scrolling: touch;
457458
}
458459
.modals.dimmer .ui.scrolling.modal:not(.fullscreen) {
@@ -467,6 +468,7 @@
467468
/* Undetached Scrolling */
468469
.scrolling.undetached.dimmable.dimmed {
469470
overflow: auto;
471+
overscroll-behavior: @overscrollBehavior;
470472
-webkit-overflow-scrolling: touch;
471473
}
472474
.scrolling.undetached.dimmable.dimmed > .dimmer {
@@ -482,6 +484,7 @@
482484
.ui.modal > .scrolling.content {
483485
max-height: @scrollingContentMaxHeight;
484486
overflow: auto;
487+
overscroll-behavior: @overscrollBehavior;
485488
}
486489
}
487490

src/definitions/modules/search.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@
403403
.ui.search.short > .results {
404404
overflow-x: hidden;
405405
overflow-y: auto;
406+
overscroll-behavior: @overscrollBehavior;
406407
backface-visibility: hidden;
407408
-webkit-overflow-scrolling: touch;
408409
}

src/definitions/modules/sidebar.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
border-radius: 0 !important;
4242
margin: 0 !important;
4343
overflow-y: auto !important;
44+
overscroll-behavior: @overscrollBehavior;
4445
z-index: @topLayer;
4546
}
4647

src/themes/default/elements/container.variables

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@
5151
@computerVeryRelaxedGridWidth: e(%("calc(%d + %d)", @computerWidth, @veryRelaxedGridGutterWidth));
5252
@largeMonitorVeryRelaxedGridWidth: e(%("calc(%d + %d)", @largeMonitorWidth, @veryRelaxedGridGutterWidth));
5353

54-
/*-------------------
55-
Scrolling
56-
--------------------*/
57-
@scrollingMobileMaxHeight: 15em;
58-
@scrollingTabletMaxHeight: 18em;
59-
@scrollingComputerMaxHeight: 24em;
60-
@scrollingWidescreenMaxHeight: 30em;
6154

6255
/*-------------------
6356
Types

src/themes/default/elements/segment.variables

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,3 @@
154154
;
155155
@tertiaryInvertedColor: @invertedMutedTextColor;
156156

157-
/*-------------------
158-
Scrolling
159-
--------------------*/
160-
@scrollingMobileMaxHeight: 15em;
161-
@scrollingTabletMaxHeight: 18em;
162-
@scrollingComputerMaxHeight: 24em;
163-
@scrollingWidescreenMaxHeight: 30em;

0 commit comments

Comments
 (0)