Skip to content

Commit b8f451a

Browse files
MaxGhenisclaude
andcommitted
Fix overflow:hidden blocking scroll on html/body
The mita page (and others) have overflow:hidden on html and body, which completely blocks programmatic scrolling. Now we override this with overflow:auto !important in our injected CSS. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent df696b2 commit b8f451a

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

scroll-utils.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ export function createSmoothScrollFunction(totalDistance) {
2121
export const SCROLL_OVERRIDE_ID = 'scrollywood-scroll-override';
2222

2323
/**
24-
* Returns CSS that disables smooth scrolling to allow programmatic control.
25-
* This overrides scroll-behavior: smooth set in stylesheets, which can
26-
* conflict with window.scrollTo({ behavior: 'instant' }) in some browsers.
24+
* Returns CSS that enables programmatic scrolling.
25+
* - Disables scroll-behavior: smooth which conflicts with scrollTo()
26+
* - Removes overflow: hidden which can block scrolling entirely
2727
*/
2828
export function getScrollBehaviorOverrideCSS() {
29-
return 'html, body, * { scroll-behavior: auto !important; }';
29+
return `
30+
html, body {
31+
overflow: auto !important;
32+
overflow-y: auto !important;
33+
scroll-behavior: auto !important;
34+
}
35+
* { scroll-behavior: auto !important; }
36+
`;
3037
}
3138

3239
// Minimum scroll height threshold - anything below this is considered "not scrollable"

scroll-utils.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ describe('scroll-utils', () => {
5555
const css = getScrollBehaviorOverrideCSS();
5656
expect(css).toContain('*');
5757
});
58+
59+
it('should override overflow:hidden that blocks scrolling', () => {
60+
const css = getScrollBehaviorOverrideCSS();
61+
expect(css).toContain('overflow');
62+
expect(css).toContain('auto');
63+
});
5864
});
5965

6066
describe('SCROLL_OVERRIDE_ID', () => {

0 commit comments

Comments
 (0)