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
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/116349535>
Alexey Proskuryakov
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
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
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
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
Interesting. We coincidentally have 10% memory regression on Wikipedia in iOS as well. I wonder if they're related.
Ryosuke Niwa
Pull request: https://github.com/WebKit/WebKit/pull/18532
EWS
Committed 268782@main (ffd8a014dd11): <https://commits.webkit.org/268782@main>
Reviewed commits have been landed. Closing PR #18532 and removing active labels.