Skip to content

Commit b9c2df5

Browse files
Fix scrolling behavior on docs mobile web (#13905)
1 parent 2afd22e commit b9c2df5

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

docs/docs/components/ApiReference.jsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,20 @@ function buildStyles() {
404404
width: min(86vw, var(--vocs-sidebar_width, 300px)) !important;
405405
min-width: min(86vw, var(--vocs-sidebar_width, 300px)) !important;
406406
max-width: min(86vw, var(--vocs-sidebar_width, 300px)) !important;
407+
height: 100%;
408+
max-height: 100%;
409+
overflow-y: auto !important;
410+
-webkit-overflow-scrolling: touch;
411+
overscroll-behavior: contain;
412+
touch-action: pan-y;
413+
}
414+
415+
.sl-elements aside.sl-flex .sl-overflow-y-auto,
416+
.sl-elements aside.sl-flex [class*="overflow-y-auto"] {
417+
overflow-y: auto !important;
418+
-webkit-overflow-scrolling: touch;
419+
overscroll-behavior: contain;
420+
touch-action: pan-y;
407421
}
408422
409423
.sl-elements pre,
@@ -497,6 +511,16 @@ function patchStoplightDOM(root) {
497511
el.style.setProperty('--color-text-muted', '#343B49')
498512
}
499513
})
514+
515+
const isMobile = window.matchMedia(MOBILE_QUERY).matches
516+
if (isMobile) {
517+
root.querySelectorAll('aside.sl-flex, aside [class*="overflow-y-auto"]').forEach((el) => {
518+
el.style.setProperty('overflow-y', 'auto', 'important')
519+
el.style.setProperty('-webkit-overflow-scrolling', 'touch')
520+
el.style.setProperty('overscroll-behavior', 'contain')
521+
el.style.setProperty('touch-action', 'pan-y')
522+
})
523+
}
500524
}
501525

502526
export default function ApiReference() {

0 commit comments

Comments
 (0)