Tuesday, January 26, 2016

Re: GWT custom scrollIntoView() implementation


AFAIK GWT 2.8 will have jsinterop and elemental so the native scrollIntoView() will be used automatically.

Only if you use Elemental of course ;)


I don't have a problem to file a bug report in GWT but I thought I should ask first here about the reasoning of the current status.

Maybe the native scrollIntoView was not supported in all browsers back in the days in 2008 when that code was written. Or the behavior was flaky in most browsers. But its kind of strange if the current implementation does not work in Chrome and Google did not noticed it. GWT has a test case for it and I would assume that at least Google runs all tests in real browsers every now and then and not just in HtmlUnit (the test is disabled for HtmlUnit). So I think the issue should have been spotted. 

https://gwt.googlesource.com/gwt/+/master/user/test/com/google/gwt/dom/client/ElementTest.java#529

Have you tried other Chrome versions? Chrome tends to be super smart about avoiding browser reflows so maybe all the element information wasn't calculated yet correctly at the time scrollIntoView() was called and thus the implementation did not work. Have you tried wrapping scrollIntoView() with a deferred command just to see if it then starts to work?

Anyways if the test case continues to work when using the native method and the native method works equally well in browsers including IE8+ then I am pretty sure the custom implementation can be swapped with the native implementation nowadays. 

-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment