Page MenuHomePhabricator

Uncaught TypeError: Cannot read property 'ownerDocument' of undefined
Closed, ResolvedPublic

Description

Splitting from T278253#6939120. If you visit the AbuseLog on frwiki, the following error will sometimes appear in the console:

 Uncaught TypeError: Cannot read property 'ownerDocument' of undefined
at Object.OO.ui.Element.static.getDocument
at Object.OO.ui.Element.static.getClosestScrollableContainer
at OoUiPopupWidget.OO.ui.mixin.FloatableElement.togglePositioning
at OoUiPopupWidget.OO.ui.PopupWidget.toggle
at showTipsy https://fr.wikipedia.org/w/load.php?lang=it&modules=ext.centralNotice.geoIP%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.cx.eventlogging.campaigns%7Cext.echo.api%2Cinit%7Cext.eventLogging%2CnavigationTiming%2CwikimediaEvents%7Cext.uls.common%2Ccompactlinks%2Cinterface%2Cpreferences%2Cwebfonts%7Cjquery%2Coojs%2Coojs-ui-core%2Coojs-ui-widgets%2Csite%7Cjquery.client%2Ccookie%2ClengthLimit%2CmakeCollapsible%2CtextSelection%7Cjquery.uls.data%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2Chtmlform%2CjqueryMsg%2Clanguage%2Cstorage%2Cuser%2Cutil%2Cwidgets%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.htmlform.ooui%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.widgets.UserInputWidget%2Cdatetime%7Coojs-ui-widgets.icons%7Coojs-ui.styles.icons-content%2Cicons-moderation%2Cicons-movement%7Cskins.vector.js%7Cuser.defaults&skin=vector&version=cl315:97

which seems to originate from ULS (ext.uls.interface.js).

In order to trigger the bug more reliably, you might try adding uselang=<insert-any-code-here> to the URL. When doing so for the first time for a given language, I consistently get the error.

Outcome

Language undo tooltip now works on pages without language settings element and does not cause a JavaScript error.

Event Timeline

I believe this is due to change in Vector which hides the language selector completely on special pages. The language undo change tooltip does not find an entry point and fails to position.

Where should the tooltip be positioned on these cases?

Where should the tooltip be positioned on these cases?

In the absence of specific language settings, the general "preferences" link can be a good anchor (or the user menu where that link may be). the general idea is to point where users can find a way to make adjustments about the element that has changed.

Change 679286 had a related patch set uploaded (by Nikerabbit; author: Nikerabbit):

[mediawiki/extensions/UniversalLanguageSelector@master] Avoid JavaScript errors for tipsy if no entry point on the page

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

Change 679286 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@master] Avoid JavaScript errors for tipsy if no entry point on the page

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

Confirmed with manual testing and Logstash.