Page MenuHomePhabricator

Don’t use heading elements (<h4>) in Wikibase diffs
Closed, ResolvedPublic

Description

As a tool developer, I want to embed diffs generated by Wikibase in my tool, in order to present an edit to my users.

Problem:
Wikibase wraps time values in diffs in <h4> elements. On Wikibase pages, this looks fine, due to the stylesheets in effect (I’m not sure if the relevant stylesheets are by Wikibase or general to MediaWiki):

Screenshot_2019-04-11 Difference between revisions of Lara Méndez López (Q20535136) - Wikidata.png (352×845 px, 32 KB)

However, when embedded in an external tool a using different set of stylesheets, the heading becomes disturbingly large:

Screenshot_2019-04-11 SpeedPatrolling.png (304×575 px, 21 KB) Screenshot_2019-04-11 SpeedPatrolling(1).png (1×720 px, 89 KB)

I’m not sure why we use <h4> elements for this. (They seem to have been introduced in PS4 of I29c083b31c.) Semantically, I’m pretty sure the date values are not headings. This also causes at least one other issue, see T87021.

As far as I can tell from the code, quantity and globe coordinate diffs also use <h4> elements, though I don’t recall those being problematic in SpeedPatrolling – I suppose they’re just less frequent.

Example:

Acceptance criteria:

  • time, quantity and globe coordinate diffs no longer use heading elements

Event Timeline

@daniel can you chime in/give some background information?

@daniel can you chime in/give some background information?

I don't think there is a specific reason for this. It's a "heading" in the sense that it's followed by more detailed, and it "looked right" at the time. But the choice of <h4> is dubious. Replacing it should not be a problem.

Change 504527 had a related patch set uploaded (by Michael Große; owner: Michael Große):
[mediawiki/extensions/Wikibase@master] Don’t use heading elements in Wikibase diffs

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

Change 504527 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Don’t use heading elements in Wikibase diffs

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

I can verify it once it’s been deployed on Wikidata. Unfortunately, there’s no train this week (releng offsite), so that’ll have to wait until next Wednesday or Thursday.

I just noticed that coordinate values still use h4 (example link). Quantity values, too, according to a code search (didn’t see that “in the wild” yet). Should I open another task for those or do we reopen this one?

Thanks for finding this 👍 But let's make that a new which that references this one. Otherwise, it might be confusing

Change 703920 had a related patch set uploaded (by Lucas Werkmeister; author: Lucas Werkmeister):

[mediawiki/extensions/Wikibase@master] Don’t style heading elements in Wikibase diffs

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

Change 703920 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Don\u2019t style heading elements in Wikibase diffs

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