Fix interaction of "Add topic" button with categories

For real this time. I hope.

Follow-up to 52de4b0b1b.

Bug: T335219
Change-Id: I0f073cf660f221c1e996f7f46d161316e0b0b79e
This commit is contained in:
Bartosz Dziewoński 2023-09-17 22:24:40 +02:00
parent 6b633803c8
commit 0c1ec851bf
2 changed files with 20 additions and 4 deletions

View file

@ -823,10 +823,24 @@ h1, h2, h3, h4, h5, h6 {
}
// Tweak to prevent our footer buttons from overlapping Minerva skin elements (T328452).
.ext-discussiontools-init-button-notFlush {
// In cases where the "Read as wiki page" button is not shown:
.client-nojs .ext-discussiontools-init-new-topic,
.ext-discussiontools-init-new-topic-pinned.ext-discussiontools-init-button-notFlush {
margin-bottom: 32px;
}
// In cases where the "Read as wiki page" button is shown:
// stylelint-disable-next-line selector-class-pattern
.client-js .skin-minerva.ns-talk.ext-discussiontools-replytool-enabled {
.ext-discussiontools-init-new-topic-pinned.ext-discussiontools-init-button-notFlush {
margin-bottom: -32px;
}
.ext-discussiontools-init-readAsWikiPage.ext-discussiontools-init-button-notFlush {
margin-bottom: 32px;
}
}
.ext-discussiontools-init-lede-button-container {
margin: 0.5em 0;

View file

@ -86,6 +86,9 @@ function init( $container ) {
mw.track( 'webuiactions_log.show', 'lede-button' );
}
// eslint-disable-next-line no-jquery/no-global-selector
var $newTopicWrapper = $( '.ext-discussiontools-init-new-topic' );
if (
!newTopicButton &&
// eslint-disable-next-line no-jquery/no-global-selector
@ -95,8 +98,6 @@ function init( $container ) {
newTopicButton = OO.ui.infuse( $( '.ext-discussiontools-init-new-topic-button' ) );
// For compatibility with MobileWebUIActionsTracking logging (T295490)
newTopicButton.$element.attr( 'data-event-name', 'talkpage.add-topic' );
// eslint-disable-next-line no-jquery/no-global-selector
var $newTopicWrapper = $( '.ext-discussiontools-init-new-topic' );
var $scrollContainer = $( OO.ui.Element.static.getClosestScrollableContainer( document.body ) );
var $scrollListener = $scrollContainer.is( 'html, body' ) ? $( OO.ui.Element.static.getWindow( $scrollContainer[ 0 ] ) ) : $scrollContainer;
var lastScrollTop = $scrollContainer.scrollTop();
@ -148,7 +149,7 @@ function init( $container ) {
/* eslint-disable no-jquery/no-global-selector */
if ( newTopicButton ) {
$( '.ext-discussiontools-init-new-topic' ).after( $readAsWikiPage );
$newTopicWrapper.after( $readAsWikiPage );
} else {
$( '#mw-content-text' ).append( $readAsWikiPage );
}
@ -163,6 +164,7 @@ function init( $container ) {
$( '.return-link' ).length
) {
$readAsWikiPage.addClass( 'ext-discussiontools-init-button-notFlush' );
$newTopicWrapper.addClass( 'ext-discussiontools-init-button-notFlush' );
}
/* eslint-enable no-jquery/no-global-selector */
}