Page MenuHomePhabricator

'vector-body-before-content' container create too much white space on subpages in Vector 2022
Open, MediumPublicBUG REPORT

Assigned To
None
Authored By
Iniquity
Feb 29 2024, 5:37 PM
Referenced Files
F60322998: obraz.png
May 20 2025, 9:00 PM
F60320927: obraz.png
May 20 2025, 9:00 PM
F60252016: image.png
May 19 2025, 7:10 PM
F54907053: Screenshot 2024-06-03 at 11.44.25 AM.png
Jun 3 2024, 3:45 PM
F54906506: Screenshot 2024-06-03 at 11.21.40 AM.png
Jun 3 2024, 3:32 PM
F42257812: image.png
Feb 29 2024, 5:37 PM
F42257796: image.png
Feb 29 2024, 5:37 PM

Description

In the new vector, everything that was previously at the top of the page has been combined into a separate container without floating, which creates extra empty space on subpages. I honestly haven't figured out how to solve this problem locally.

Steps to replicate the issue (include links if applicable):

image.png (627×1 px, 79 KB)

What happens?:

image.png (891×1 px, 203 KB)

What should have happened instead?:
The area should be filled evenly.

Other information (browser name/version, screenshots, etc.):
Google Chrome latest, Win11

Event Timeline

ovasileva moved this task from Incoming to Groomed on the Web-Team-Backlog-Archived board.
ovasileva moved this task from Groomed to Incoming on the Web-Team-Backlog-Archived board.
ovasileva moved this task from Incoming to Groomed on the Web-Team-Backlog-Archived board.
ovasileva subscribed.

I think issue should be solved inside the gadget code. If the gadget inserted the links inside the indicators element, then that would look like this:

Screenshot 2024-06-03 at 11.21.40 AM.png (440×1 px, 115 KB)

I'm not sure how to implement this exactly, but I would guess it involves using the following hook (not much documention on that though).

function insertLinks( $content ) {
  $content.append( "<h1> new link content goes here</h1>" );
};
mw.hook( 'wikipage.indicators' ).add( insertLinks );

Alternatively, plwiki has this kind of gadget enabled by default. In that implementation, the edit link appears beside the title of the page:

Screenshot 2024-06-03 at 11.44.25 AM.png (560×1 px, 152 KB)

Jdlrobson added a subscriber: Jdrewniak.

@putnik it seems like you had a go at fixing this is in https://ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-edittop.js&diff=prev&oldid=130146051 but I saw it got brought up again in the recent VPT discussion.

Is this fixed?
If not, per Jan's suggestion above, perhaps this code is what you need (to move it next to the title)?

runAsEarlyAsPossible( function addEditTopLinks() {
	const currentSkin = mw.config.get( 'skin' );
	const direction = $( document.body ).hasClass( 'rtl' ) ? 'rtl' : 'ltr';
	const appendLink = ( $section ) => {
		switch ( currentSkin ) {
			case 'vector-2022':
				return $section.insertAfter( '#firstHeading .mw-page-title-main' );
			default:
				return $section.prependTo( '#bodyContent' );
		}
	}

	const getCss = () => {
		const css = {
			position: 'relative',
			zIndex: 2
		}
		switch ( currentSkin ) {
			case 'vector-2022':
				return css;
			default:
				return Object.assign( {}, css, {
					float: direction === 'ltr' ? 'right' : 'left',
					clear: direction === 'ltr' ? 'right' : 'left',
					marginTop: '-0.25em',
					lineHeight: 'inherit',
					dir: direction,
					marginTop: '.5em'
				} );
		}
	}
	if ( !mw.config.get( 'wgArticleId' ) || mw.config.get( 'wgAction' ) !== 'view' ) {
		return;
	}
	
	var $section = $( '#mw-content-text' )
		.find( '.mw-heading2 .mw-editsection, h2 .mw-editsection' )
		.first()
		.clone()
		.css( getCss() )
		.addClass( 'mw-content-' + direction + ' ve-hide' );

	appendLink( $section );
	var $links = $section.find( 'a' );
	var hrefStart = mw.config.get( 'wgScript' ) + '?title=' + mw.util.wikiUrlencode( mw.config.get( 'wgPageName' ) );
	$links.each( function() {
		var $link = $( this );
		// The variable "zeroSectionTip" is defined in [[ru:MediaWiki:Common.js#L-59]]
		if ( typeof zeroSectionTip !== 'undefined' ) {
			$link.attr( 'title', zeroSectionTip );
		}
		var href = hrefStart + (
			$link.hasClass( 'mw-editsection-visualeditor' ) ?
			'&veaction=edit&section=0' :
			'&action=edit&section=0&summary=/*%20Преамбула%20*/%20'
		);
		$link.attr( 'href', href );
	} );
}, $( '#mw-content-text' ).find( '.mw-heading2, h2' ).next() );

Alternatively, plwiki has this kind of gadget enabled by default. In that implementation, the edit link appears beside the title of the page:

Even without the gadget, there is clearly an issue here with the breadcrumbs on the left being on a whole separate row from the indicators on the right. So yes, the gadget work can be discussed, but this issue is broader than that even if @Iniquity did not explain it fully enough.

On the placement of the link and this suggested code, I think it is incorrect from accessibility standpoint, see T13555: .mw-editsection links should not be part of the <h#> element. Additionally, in Vector 2022 especially it is a bad placement because it would imply that the whole article can be edited using that link, as opposed to the lead section.

Following the conversation with @putnik about this, I submitted changes that make the gadget work like this instead:

image.png (210×1 px, 28 KB)

Polish Wikipedia still has an issue where there is an empty space where #siteSub element is located but Russian Wikipedia issue is resolved (as long as no one objects to it on the forum, where I would put a short announcement about it).

That's awesome. Thanks @putnik and @stjn

@Nux would you be able to help work out if Polish Wikipedia also need to make this change?

Added a skip link before the edit link (T390482). That should cover WCAG problems arising from a link in header (or at least some of it) and also resolve some other issues.

obraz.png (189×988 px, 25 KB)

@stjn I assume you are talking about this gap?

obraz.png (355×1 px, 54 KB)

I don't know if this is a community problem or a skin problem. The gap is because we don't use #siteSub (which contains a tag line: "From Wikipedia, the free encyclopedia"). This would fix the gap (I can add that to site css):

<div class="vector-body-before-content" style="float: right;">

Seems like enwiki is non-standard in this case:
https://en.wikipedia.org/w/index.php?title=MediaWiki:Common.css&oldid=1278705130#:~:text=%23-,siteSub

Yes, I was talking about that gap (caused by the skin).

I don’t think the accessibility issue is resolved by a skip link in any meaningful way, as T13555 details. The issue is that the header is wrongfully announced as [Full title] edytuj if you try to use it for navigation. Now, after your edit, it is in most senses even worse, since that skip link is also added to the header, so the header text is now announced as [Full title] Przejdź do treści edytuj. The thing that needs to be fixed is the edit link (as well as any other elements) being inside <h1>. The problem is that while Vector 2022 allows to fix that potentially, other skins do not.

I don’t think the accessibility issue is resolved by a skip link in any meaningful way, as T13555 details. The issue is that the header is wrongfully announced as [Full title] edytuj if you try to use it for navigation. Now, after your edit, it is in most senses even worse, since that skip link is also added to the header, so the header text is now announced as [Full title] Przejdź do treści edytuj. The thing that needs to be fixed is the edit link (as well as any other elements) being inside <h1>. The problem is that while Vector 2022 allows to fix that potentially, other skins do not.

Yes, I know, but #p-associated-pages, #right-navigation and nav in .vector-column-end is actually a bigger problem when you start from h1.

Yeah, but at that point that should be maybe something that is looked into by Vector 2022 developers. I would also note that there is a skip link at the start of the page that leads to the same place your wrongfully placed skip link leads to.

The problem is that while Vector 2022 allows to fix that potentially, other skins do not.

File a bug for those other skins and we can get it fixed.

See also: T336611: Make #siteSub element visible by default

(Adding this comment for documentation purposes)

This is what we communicated on Forum last time we talked about it:

We recommend making changes directly to the gadget. The next step will be for technical editors to review the proposal. Our engineers will be available to answer questions and, if necessary, provide further recommendations for resolving the issue.