From 52de4b0b1bceac50f314d0529a96113dac15583a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 1 Feb 2023 17:46:39 +0100 Subject: [PATCH] Fix interaction of "Add topic"/"Read as wiki page" buttons with categories Bug: T328452 Change-Id: Iabb52c73e4b4a83175d95d8d542ef752f6f961dc --- modules/dt.init.less | 5 +++++ modules/mobile.js | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/dt.init.less b/modules/dt.init.less index a05edea82..afb2e459e 100644 --- a/modules/dt.init.less +++ b/modules/dt.init.less @@ -872,6 +872,11 @@ h1, h2, h3, h4, h5, h6 { } } +// Tweak to prevent our footer buttons from overlapping Minerva skin elements (T328452). +.ext-discussiontools-init-button-notFlush { + margin-bottom: 32px; +} + .ext-discussiontools-init-lede-button-container { margin: 0.5em 0; diff --git a/modules/mobile.js b/modules/mobile.js index 09c2a140f..890f778cb 100644 --- a/modules/mobile.js +++ b/modules/mobile.js @@ -142,13 +142,26 @@ function init( $container ) { $( document.body ).removeClass( 'ext-discussiontools-visualenhancements-enabled ext-discussiontools-replytool-enabled' ); } ); } + + /* eslint-disable no-jquery/no-global-selector */ if ( newTopicButton ) { - // eslint-disable-next-line no-jquery/no-global-selector $( '.ext-discussiontools-init-new-topic' ).after( $readAsWikiPage ); } else { - // eslint-disable-next-line no-jquery/no-global-selector $( '#mw-content-text' ).append( $readAsWikiPage ); } + + // Tweak to prevent our footer buttons from overlapping Minerva skin elements (T328452). + // TODO: It would be more elegant to do this in just CSS somehow. + // BEWARE: I have wasted 4 hours here trying to make that happen. The elements are not nested in a + // helpful way, and moving them around tends to break the stickiness of the "Add topic" button. + if ( + $( '.catlinks[data-mw="interface"]' ).length || + $( '#page-secondary-actions > *' ).length || + $( '.return-link' ).length + ) { + $readAsWikiPage.addClass( 'ext-discussiontools-init-button-notFlush' ); + } + /* eslint-enable no-jquery/no-global-selector */ } module.exports = {