Skip to content

Commit b5f16f8

Browse files
MaxGhenisclaude
andcommitted
Remove CSS override for step-based scroll to preserve sticky positioning
The overflow:auto override can break position:sticky elements. For step-based scrolling using scrollIntoView, remove the CSS override since it's not needed. Also use behavior:'instant' for predictability. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 84729bf commit b5f16f8

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

background.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,20 +198,27 @@ async function injectScrollScript(tabId, duration) {
198198
}
199199

200200
if (stepElements.length > 0) {
201+
// Remove the CSS override - it can break sticky positioning
202+
// scrollIntoView doesn't need scroll-behavior override
203+
const existingOverride = document.getElementById(overrideId);
204+
if (existingOverride) {
205+
existingOverride.remove();
206+
console.log('[Scrollywood] Removed CSS override for step-based scroll');
207+
}
208+
201209
// Step-by-step scrolling using scrollIntoView
202210
const timePerStep = (scrollDuration * 1000) / stepElements.length;
203211
let currentStep = 0;
204212

205213
function scrollToNextStep() {
206214
if (currentStep >= stepElements.length) {
207-
const override = document.getElementById(overrideId);
208-
if (override) override.remove();
209215
console.log('[Scrollywood] Step-based scroll complete');
210216
return;
211217
}
212218

213219
const element = stepElements[currentStep];
214-
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
220+
// Use instant to avoid conflicts, browser will still trigger IO
221+
element.scrollIntoView({ behavior: 'instant', block: 'center' });
215222
console.log('[Scrollywood] Scrolling to step', currentStep + 1, 'of', stepElements.length);
216223
currentStep++;
217224
setTimeout(scrollToNextStep, timePerStep);

0 commit comments

Comments
 (0)