Skip to content

Commit

Permalink
twinkle: fix vector-2022 TW menu bug (wikimedia-gadgets#1896)
Browse files Browse the repository at this point in the history
* twinkle: fix vector-2022 TW menu bug

Fixes wikimedia-gadgets#1895 TW menu becomes unusable in vector-2022 if you dock the tools menu to the right side

* same element for both lines
  • Loading branch information
NovemLinguae committed Dec 4, 2023
1 parent 6e30957 commit 4f31985
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions twinkle.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,15 @@ Twinkle.addPortlet = function(navigation, id, text, type, nextnodeid) {

var portlet = mw.util.addPortlet(id, text, '#' + nextnodeid);

// The Twinkle dropdown menu has been added to the left of p-cactions. Move it to the right.
// The Twinkle dropdown menu has been added to the left of p-cactions, since that is the only spot that will create a dropdown menu. But we want it on the right. Move it to the right.
if (mw.config.get('skin') === 'vector') {
$('#p-twinkle').insertAfter('#p-cactions');
} else if (mw.config.get('skin') === 'vector-2022') {
$('#p-twinkle-dropdown').appendTo('.vector-page-tools-landmark');
var $landmark = $('#right-navigation > .vector-page-tools-landmark');
$('#p-twinkle-dropdown').insertAfter($landmark);

// .vector-page-tools-landmark is unstable and could change. If so, log it to console, to hopefully get someone's attention.
if (!document.querySelector('.vector-page-tools-landmark')) {
if (!$landmark) {
mw.log.warn('Unexpected change in DOM');
}
}
Expand Down

0 comments on commit 4f31985

Please sign in to comment.