Page MenuHomePhabricator

Section edit link brackets are wrapping poorly
Closed, ResolvedPublic

Description

The section edit links look like [ edit | edit source ] and are in a <span class="mw-editsection"> following the heading tag inside a <div class="mw-heading">.

The brackets surrounding them wrap separately from the links, which doesn't look very good:

CleanShot 2026-07-13 at 17.16.51@2x.png (1,992×238 px, 71 KB)

Ideally what would happen would be one of:

  1. The bracket binds to the link within it ([ edit\n | edit source ] (sort of awkward because then we have to choose how the separator binds)
  2. The entire mw-editsection wraps as a unit

These two cases are identical on single-tab wikis since the user will only see [ edit ] or [ edit source ] there.

This might be a regression from the changes for T268900, I'm not sure. It could also have been around for ages and I only just happened to notice it.

Event Timeline

Change #1311124 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Improve line breaking around section edit links

https://gerrit.wikimedia.org/r/1311124

Change #1311125 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Update styles for hiding VE section edit link on no-JS

https://gerrit.wikimedia.org/r/1311125

Ideally what would happen would be one of:

  1. The bracket binds to the link within it ([ edit\n | edit source ] (sort of awkward because then we have to choose how the separator binds)

It was a bit tricky, but I got that to work. It looks better to me when the separator binds to the preceding link, so I made it work that way, although the other way is also doable.

One drawback of the solution I found is that it makes it more difficult to hide individual links with CSS without removing them from the DOM/HTML. As far as I know we only do that in VisualEditor (to hide the VE link in no-JS), so I hope we can live with that, but if it causes more problems, we can always do option 2, which is much easier (just revert and add white-space: nowrap).

  1. The entire mw-editsection wraps as a unit

I'd rather avoid that, since that unit can be pretty long,. when you have both links, like [ edit | edit source ] (and perhaps even three or more, like [ edit | edit source | share ]).

  1. The entire mw-editsection wraps as a unit

I'd rather avoid that, since that unit can be pretty long,. when you have both links, like [ edit | edit source ] (and perhaps even three or more, like [ edit | edit source | share ]).

And the English wording of links can be generously short. Other languages are much longer.

Change #1311124 merged by jenkins-bot:

[mediawiki/core@master] Improve line breaking around section edit links

https://gerrit.wikimedia.org/r/1311124

Change #1311125 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update styles for hiding VE section edit link on no-JS

https://gerrit.wikimedia.org/r/1311125

I'd rather avoid that, since that unit can be pretty long,. when you have both links, like [ edit | edit source ]

This looks clumsy though

Screenshot 2026-07-21 at 15-55-24 Global catastrophic risk - Wikipedia.png (522×88 px, 5 KB)

How do you think it should look?

How do you think it should look?

I’d at least put the pipe before the line break, similar to how hlist dots are on the previous line, hyphenation happens on the previous line etc.

The pipe is already being placed before the line break. That screenshot must have been taken before the patch from this task was deployed.

I see, thanks for having implemented my wish before I said it! ☺

How do you think it should look?

With links grouped together after the line break

Screenshot 2026-07-21 at 06-44-16 Global catastrophic risk - Wikipedia.png (522×103 px, 5 KB)
instead of placing them in opposite corners of the block which happens now. These are two options to perform the same task, and keeping them apart is not good.