Bug 262358

Summary: REGRESSION (267023@main): The language switching menu is broken on English Wikipedia
Product: WebKit Reporter: laiz+webkit
Component: WebCore Misc.Assignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, cdumez, karlcow, rniwa, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Mac (Apple Silicon)   
OS: macOS 14   
URL: https://en.wikipedia.org/
See Also: https://bugs.webkit.org/show_bug.cgi?id=262551
Bug Depends on: 260369    
Bug Blocks:    

laiz+webkit
Reported 2023-09-29 01:49:09 PDT
Overview: After browsing through a few articles on the English Wikipedia, the language switcher located at the top right of each page does not respond to the user's clicks. Steps to reproduce: 1. Go to https://en.wikipedia.org/wiki/Main_Page 2. Click any article link 3. Try to open the list of other languages the article is available in 4. If it still works, repeat steps 2 and 3 Actual result: The language list no longer opens. Expected result: The language list should open as expected. Build Date & Hardware: Safari Technology Preview Release 179 (Safari 17.0, WebKit 19617.1.8.1) MacBook Air M1, 2020 macOS Sonoma 14.0 Additional Builds and Platforms: I am unable to reproduce this issue on Safari Version 17.0 (19616.1.27.211.1)
Attachments
Radar WebKit Bug Importer
Comment 1 2023-10-02 09:15:53 PDT
Alexey Proskuryakov
Comment 2 2023-10-02 09:19:51 PDT
I can reproduce as described. Shift-reload doesn't help, but opening the same article in a new window does. There aren't any errors in Web Inspector console.
Karl Dubost
Comment 3 2023-10-02 15:55:49 PDT
No events at all seem to be taking place. The function which captures the clicks for the language selector is: ``` function loadContentLanguageSelector(ev) { var $target = $(ev.currentTarget); if ($target.attr('data-uls-loaded')) { return; } ev.preventDefault(); mw.loader.using(['ext.uls.mediawiki', 'mediawiki.ui.button']).then(function() { var parent, languageNodes, standalone, uls; parent = document.querySelectorAll('.mw-portlet-lang, #p-lang')[0]; languageNodes = parent ? parent.querySelectorAll('.interlanguage-link-target') : []; standalone = isUsingStandaloneLanguageButton(); $target.attr('data-uls-loaded', true); launchULS($target, mw.uls.getInterlanguageListFromNodes(languageNodes), !standalone); if (standalone) { uls = $target.data('uls'); if (languageNodes.length) { addActionsMenuTriggers(uls); } else { uls.$menu.find('#uls-settings-block').eq(0).hide(); addEmptyState(uls); } $target.trigger('click'); } else { $target.trigger('click'); } }); } ``` we could try to Autospade this (regression testing)
Karl Dubost
Comment 4 2023-10-02 16:08:13 PDT
Important for the testers. Loading directly the page will not reproduce the issue. It is necessary to navigate from the homepage to another one.
Karl Dubost
Comment 5 2023-10-02 16:45:21 PDT
I get this range https://commits.webkit.org/compare/267023@main...267017@main I wonder if it's the activation of requestIdleCallback. loadContentLanguageSelector is available in Firefox Nightly but it has not even been loaded in STP, aka it doesn't exist. If we search for requestIdleCallback, we see that this is used to load a bunch of resources. for example in ``` mw.requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback.bind(window) : mw.requestIdleCallbackInternal; (function() { var queue; mw.loader.addSource({ "local": "/w/load.php", "metawiki": "//meta.wikimedia.org/w/load.php" }); ``` when requestIdleCallback was not available it was using ``` mw.requestIdleCallbackInternal = function(callback) { setTimeout(function() { var start = mw.now(); callback({ didTimeout: false, timeRemaining: function() { return Math.max(0, 50 - (mw.now() - start)); } }); }, 1); }; ``` Another confirmation, if in the Developer Menu -> Feature Flags and disable requestIdleCallback, the language selector is working again after reload. So there is something which is not quite fully working with the native implementation in terms of timing when doing: window.requestIdleCallback.bind(window)
Ryosuke Niwa
Comment 6 2023-10-02 17:45:21 PDT
Interesting. We coincidentally have 10% memory regression on Wikipedia in iOS as well. I wonder if they're related.
Ryosuke Niwa
Comment 7 2023-10-02 21:33:15 PDT
EWS
Comment 8 2023-10-03 08:59:17 PDT
Committed 268782@main (ffd8a014dd11): <https://commits.webkit.org/268782@main> Reviewed commits have been landed. Closing PR #18532 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.