diff options
author | jenkins-bot <jenkins-bot@gerrit.wikimedia.org> | 2021-12-23 00:58:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@wikimedia.org> | 2021-12-23 00:58:43 +0000 |
commit | e6f92bf97c4fc967372f24e879d526fed351f12e (patch) | |
tree | 8c25e861989bef0ac11fb18bfd0dc7734af473bf | |
parent | 4dfffac93713b50f5d72f79f7fa8f0c9ac9a3a7e (diff) | |
parent | 25896e07a77035ddff9fdd88ef022a580c2970e3 (diff) |
Merge "Re-apply "Work around a Chrome bug with :target selector and Special:Preferences tabs""
-rw-r--r-- | resources/src/mediawiki.special.preferences.ooui/tabs.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/resources/src/mediawiki.special.preferences.ooui/tabs.js b/resources/src/mediawiki.special.preferences.ooui/tabs.js index 45e481cc30d4..e65fbe1804e4 100644 --- a/resources/src/mediawiki.special.preferences.ooui/tabs.js +++ b/resources/src/mediawiki.special.preferences.ooui/tabs.js @@ -17,6 +17,18 @@ tabs = OO.ui.infuse( $( '.mw-prefs-tabs' ) ); + // Support: Chrome + // https://bugs.chromium.org/p/chromium/issues/detail?id=1252507 + // + // Infusing the tabs above involves detaching all the tabs' content from the DOM momentarily, + // which causes the :target selector (used in mediawiki.special.preferences.styles.ooui.less) + // not to match anything inside the tabs in Chrome. Twiddling location.href makes it work. + // Only do it when a fragment is present, otherwise the page would be reloaded. + if ( location.href.indexOf( '#' ) !== -1 ) { + // eslint-disable-next-line no-self-assign + location.href = location.href; + } + tabs.$element.addClass( 'mw-prefs-tabs-infused' ); function enhancePanel( panel ) { |