[Webkit-unassigned] [Bug 199691] The whole viewport shifts down when resetting document scrollTop

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Jul 14 14:45:16 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=199691

--- Comment #5 from Ryosuke Niwa <rniwa at webkit.org> ---
(In reply to Xidorn Quan from comment #4)
> (In reply to Simon Fraser (smfr) from comment #3)
> > document.addEventListener('scroll', evt => {
> >   document.documentElement.scrollTop = 0;
> >   document.body.scrollTop = 0;
> > });
> > 
> > This is a really bad pattern that we see commonly; if you rubber-band the
> > content, it will also try to set the scrollTop back to 0.
> 
> I feel like this is potentially an anti-pattern, but how would you recommend
> for the case where author may want to move the element manually, for
> example, when they want to zoom to the current visible area?

The recommended approach is to move the element immediately when the input element is focused so the WebKit wouldn't try to scroll to it. In general, once the keyboard has started being brought up, there is nothing you can do to cancel the scrolling.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190714/04a17944/attachment.html>


More information about the webkit-unassigned mailing list