Page MenuHomePhabricator

VisualEditor: [Regression] Page settings dialog broken in Chrome (Uncaught TypeError: scrollTop of undefined)
Closed, ResolvedPublic

Description

Splitting from bug 54322.


Version: unspecified
Severity: critical

Details

Reference
bz54928

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 2:37 AM
bzimport set Reference to bz54928.

I can reproduce this in Chrome on en.wikipedia.org. Though not every time.

Stack trace:

Uncaught TypeError: Cannot use 'in' operator to search for 'scrollTop' in
undefined load.php?…:102
vendorPropName load.php?…:102
jQuery.extend.css load.php?…:105
Tween.propHooks._default.get load.php?…:136
Tween.cur load.php?…:136
Tween.init load.php?…:135
Tween load.php?…:135
Animation.deferred.promise.createTween load.php?…:131
tweeners.* load.php?…:129
(anonymous function) load.php?…:130
jQuery.extend.each load.php?…:8
createTweens load.php?…:130
Animation load.php?…:132
doAnimation load.php?…:137
jQuery.extend.dequeue load.php?…:25
(anonymous function) load.php?…:26
jQuery.extend.each load.php?…:8
jQuery.fn.jQuery.each load.php?…:4
jQuery.fn.extend.queue load.php?…:26
jQuery.fn.extend.animate load.php?…:138
ve.Element.scrollIntoView load.php?ext.visualEditor…:11
ve.Element.scrollElementIntoView load.php?ext.visualEditor…:12
ve.ui.OptionWidget.setSelected load.php?ext.visualEditor…:404
ve.ui.SelectWidget.selectItem load.php?ext.visualEditor…:400
ve.ui.PagedDialog.addPage load.php?ext.visualEditor…:458
ve.ui.MWMetaDialog.initialize load.php?ext.visualEditor…:461
ve.ui.Window.onFrameInitialize load.php?ext.visualEditor…:353
oo.EventEmitter.emit load.php?ext.visualEditor.bas…:133
ve.ui.Frame.load load.php?ext.visualEditor…:351
ve.ui.WindowSet.open load.php?ext.visualEditor…:356
ve.init.mw.ViewPageTarget.onToolbarMwMetaButtonClick
load.php?ext.visualEditor.bas…:87
proxy load.php?…:10
jQuery.event.dispatch load.php?…:45
elemData.handle.eventHandle load.php?…:38

In plain English:

  • User clicks Page settings button
  • Dialog doesn't exist yet, so we instantiate it and initialise it
  • MWMetaDialog.initialize adds the 'categories' section
  • SelectWidget sees we don't have a selected panel yet, and now that we have > 0 panels, it selects this new one
  • OptionWidget is brave and tries to ensure the selected panel is visibile attempting to scroll it into view
  • ve.Element traverses up from the panel element until it eventually is unable to find any element that is scrollable and falls back to ve.Element.getWindow( el )
  • We hand off this element (= detached iframe's window), to $.fn.animate which will try to animate scrollTop to 60px.

Both in our jQuery version (v1.8.3) and the current one in use on jquery.com (v1.9.1) animating scrollTop on either window, document or document.documentElement (<html>) is not supported and results in :

$(window).animate({'scrollTop': 100})
< TypeError: Cannot use 'in' operator to search for 'scrollTop' in undefined

  • $.css: There is no window.style, and thus no 'scrollTop' in window.style
  • Also, there is no window.scrollTop

$(document).animate({'scrollTop': 100})
< TypeError: Cannot read property 'ownerDocument' of null

  • There is no document.scrollTop.

$(document.documentElement).animate({'scrollTop': 100})

[ <html> ]

  • No exception, but scroll unchanged.
  • There is a document.documentElement.scrollTop, but it doesn't appear to do anything (defaults to 0, setting is a no-op)

$(document.body).animate({'scrollTop': 100})

[ <body> ]

  • Works!

.... so, we should fix getClosestScrollableContainer to not fallback to window, because that's not a viable fallback as that is in fact not a scrollable container.

Change 87442 had a related patch set uploaded by Krinkle:
(DRAFT) ve.Element: Fallback to body, window is not scrollable

https://gerrit.wikimedia.org/r/87442

Change 87442 merged by jenkins-bot:
ve.Element: Fallback to body, window is not scrollable

https://gerrit.wikimedia.org/r/87442

Change 87466 had a related patch set uploaded by Jforrester:
ve.Element: Fallback to body, window is not scrollable

https://gerrit.wikimedia.org/r/87466

Change 87467 had a related patch set uploaded by Jforrester:
ve.Element: Fallback to body, window is not scrollable

https://gerrit.wikimedia.org/r/87467

Change 87467 merged by jenkins-bot:
ve.Element: Fallback to body, window is not scrollable

https://gerrit.wikimedia.org/r/87467

Change 87466 merged by jenkins-bot:
ve.Element: Fallback to body, window is not scrollable

https://gerrit.wikimedia.org/r/87466

(In reply to comment #3)

Change 87442 merged by jenkins-bot:
ve.Element: Fallback to body, window is not scrollable

https://gerrit.wikimedia.org/r/87442

This was just deployed.