Don't insert reply tool outside <section> on mobile

Bug: T319148
Change-Id: I7db0ef1980f4997b77593f3d43d35886ecd8a4ae
This commit is contained in:
Bartosz Dziewoński 2022-10-09 21:30:10 +02:00
parent 0116bed3ad
commit d2df103803
3 changed files with 9 additions and 4 deletions

View file

@ -131,7 +131,10 @@ class CommentModifier {
// If the comment is fully covered by some wrapper element, insert replies outside that wrapper.
// This will often just be a paragraph node (<p>), but it can be a <div> or <table> that serves
// as some kind of a fancy frame, which are often used for barnstars and announcements.
$covered = CommentUtils::getFullyCoveredSiblings( $curComment, $curComment->getRootNode() );
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$excludedWrapper = CommentUtils::closestElement( $target, [ 'section' ] ) ?:
$curComment->getRootNode();
$covered = CommentUtils::getFullyCoveredSiblings( $curComment, $excludedWrapper );
if ( $curComment->getLevel() === 1 && $covered ) {
$target = end( $covered );
$parent = $target->parentNode;

View file

@ -95,7 +95,9 @@ function addListItem( comment, replyIndentation ) {
// If the comment is fully covered by some wrapper element, insert replies outside that wrapper.
// This will often just be a paragraph node (<p>), but it can be a <div> or <table> that serves
// as some kind of a fancy frame, which are often used for barnstars and announcements.
var covered = utils.getFullyCoveredSiblings( curComment, curComment.rootNode );
var excludedWrapper = utils.closestElement( target, [ 'section' ] ) ||
curComment.rootNode;
var covered = utils.getFullyCoveredSiblings( curComment, excludedWrapper );
if ( curComment.level === 1 && covered ) {
target = covered[ covered.length - 1 ];
parent = target.parentNode;

View file

@ -1,7 +1,7 @@
<script>function mfTempOpenSection(id){var block=document.getElementById("mf-section-"+id);block.className+=" open-block";block.previousSibling.className+=" open-block";}</script><div class="mw-parser-output"><section class="mf-section-0" id="mf-section-0"></section><h2 class="section-heading collapsible-heading open-block" data-event-name="talkpage.section"><div class="mw-ui-icon mw-ui-icon-mf-expand indicator mw-ui-icon-flush-left mw-ui-icon-small mf-mw-ui-icon-rotate-flip"></div><span class="mw-headline" tabindex="0" role="button" aria-controls="content-collapsible-block-0" aria-expanded="true" data-event-name="talkpage.section">a</span><span class="mw-editsection"><a href="/w/index.php?title=Talk:T319148&amp;action=edit&amp;section=1" title="Edit section: a" data-section="1" class="mw-ui-icon mw-ui-icon-element mw-ui-icon-wikimedia-edit-base20 edit-page mw-ui-icon-flush-right mw-ui-button mw-ui-quiet">Edit</a></span></h2><section class="mf-section-1 collapsible-block collapsible-block-js open-block" id="content-collapsible-block-0">
<p>hello <a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a>) 23:10, 20 October 2022 (UTC)
</p>
</section><dl><dd>Reply to c-Matma_Rex-20221020231000-</dd></dl><h2 class="section-heading collapsible-heading open-block" data-event-name="talkpage.section"><div class="mw-ui-icon mw-ui-icon-mf-expand indicator mw-ui-icon-flush-left mw-ui-icon-small mf-mw-ui-icon-rotate-flip"></div><span class="mw-headline" tabindex="0" role="button" aria-controls="content-collapsible-block-1" aria-expanded="true" data-event-name="talkpage.section">b</span><span class="mw-editsection"><a href="/w/index.php?title=Talk:T319148&amp;action=edit&amp;section=2" title="Edit section: b" data-section="2" class="mw-ui-icon mw-ui-icon-element mw-ui-icon-wikimedia-edit-base20 edit-page mw-ui-icon-flush-right mw-ui-button mw-ui-quiet">Edit</a></span></h2><section class="mf-section-2 collapsible-block collapsible-block-js open-block" id="content-collapsible-block-1">
</p><dl><dd>Reply to c-Matma_Rex-20221020231000-</dd></dl>
</section><h2 class="section-heading collapsible-heading open-block" data-event-name="talkpage.section"><div class="mw-ui-icon mw-ui-icon-mf-expand indicator mw-ui-icon-flush-left mw-ui-icon-small mf-mw-ui-icon-rotate-flip"></div><span class="mw-headline" tabindex="0" role="button" aria-controls="content-collapsible-block-1" aria-expanded="true" data-event-name="talkpage.section">b</span><span class="mw-editsection"><a href="/w/index.php?title=Talk:T319148&amp;action=edit&amp;section=2" title="Edit section: b" data-section="2" class="mw-ui-icon mw-ui-icon-element mw-ui-icon-wikimedia-edit-base20 edit-page mw-ui-icon-flush-right mw-ui-button mw-ui-quiet">Edit</a></span></h2><section class="mf-section-2 collapsible-block collapsible-block-js open-block" id="content-collapsible-block-1">
<p>hello <a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a>) 23:10, 20 October 2022 (UTC)
</p>
<dl><dd>hello <a href="/wiki/User:Matma_Rex" title="User:Matma Rex">Matma Rex</a> (<a href="/wiki/User_talk:Matma_Rex" title="User talk:Matma Rex">talk</a>) 23:10, 20 October 2022 (UTC)<dl><dd>Reply to c-Matma_Rex-20221020231000-Matma_Rex-20221020231000</dd></dl></dd><dd>Reply to c-Matma_Rex-20221020231000--1</dd></dl>