Page MenuHomePhabricator

jquery.ui.ooMenu.js should not cause warning "jQuery.fn.offset() requires an element connected to a document"
Closed, ResolvedPublic

Description

The script at

(or https://www.wikidata.org/w/extensions/Wikibase/view/lib/wikibase-data-values-value-view/lib/jquery.ui/jquery.ui.ooMenu.js?31222 )
has the line

if ( this.element.offset().left + this.element.outerWidth( true ) > $( window ).width() ) {

which causes the warning

JQMIGRATE: jQuery.fn.offset() requires an element connected to a document

in the console when visiting
https://www.wikidata.org/wiki/Special:Watchlist?debug=1

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Instead of solving this task, it would be better (but harder) to rewrite the current ooMenu without using jQuery.ui.widget but OOUI, given this component got deprecated by T142418. But if I understand correctly the dependencies between components, in addition of the suggester of the search box in non-item pages, most suggesters in items edition use ooMenu, which makes the task even harder.

Krinkle triaged this task as High priority.Jul 12 2021, 4:11 PM

Instead of solving this task, it would be better (but harder) to rewrite the current ooMenu without using jQuery.ui.widget but OOUI, given this component got deprecated by T142418. But if I understand correctly the dependencies between components, in addition of the suggester of the search box in non-item pages, most suggesters in items edition use ooMenu, which makes the task even harder.

The whole frontend is supposed to be rewritten in a more modern stack in near future (but not on roadmap yet). Rewriting it to ooui doesn't make sense as it'll be thrown away a year/several years later.

Change 704570 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/core@master] Fix deprecated offset() on invalid DOM

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

Change 704570 merged by jenkins-bot:

[mediawiki/core@master] Fix deprecated offset() on invalid DOM

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

Change 704606 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/core@wmf/1.37.0-wmf.14] Fix deprecated offset() on invalid DOM

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

Change 704606 merged by jenkins-bot:

[mediawiki/core@wmf/1.37.0-wmf.14] Fix deprecated offset() on invalid DOM

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

Mentioned in SAL (#wikimedia-operations) [2021-07-14T19:33:39Z] <ladsgroup@deploy1002> Synchronized php-1.37.0-wmf.14/resources: Backport: [[gerrit:704606|Fix deprecated offset() on invalid DOM (T185629)]] (duration: 01m 07s)

The offset bit in jquery.ui is fixed.