Skip to content

Commit 647bf9d

Browse files
committed
Fix #1639: Edge doesn't implement HTMLElement.prototype.scrollTo
1 parent 35035df commit 647bf9d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/browser-sync-client/lib/effects/set-scroll.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ export function setScrollEffect(
135135
}
136136

137137
function scrollElement(element, scrollProportionally, event: IncomingPayload) {
138-
if (scrollProportionally && element.scrollTo) {
139-
return element.scrollTo(
140-
0,
141-
element.scrollHeight * event.position.proportional
142-
); // % of y axis of scroll to px
138+
if (element.scrollTo) {
139+
if (scrollProportionally) {
140+
element.scrollTo(
141+
0,
142+
element.scrollHeight * event.position.proportional
143+
); // % of y axis of scroll to px
144+
} else {
145+
element.scrollTo(0, event.position.raw.y);
146+
}
143147
}
144-
return element.scrollTo(0, event.position.raw.y);
145148
}

0 commit comments

Comments
 (0)