Page MenuHomePhabricator

Fix paragraph spacing in Vector
Closed, ResolvedPublic2 Estimated Story Points

Description

Background

Followup to https://phabricator.wikimedia.org/T360917 and https://phabricator.wikimedia.org/T362939

Based off feedback we want to only use margins for spacing, and remove the hacky padding solution.

User story

  • As a Wikipedia reader, I want consistent spacing and information hierarchy in articles where headers are closer to the text that they are heading and there is enough spacing between paragraphs to differentiate one from another at a glance.

Design

  • Breaks between paragraphs should measure 1em of computed space, which scales depending on the size of the text selected in the Appearance menu.
  • Lists, images, tables, block quotes, and other "inline" elements should have 0.5 em of space between paragraphs

Requirement

Ensure that paragraph spacing in the Vector 2022 skin is consistent and follows the design specifications. Paragraphs should have a margin-top of 0.5em and a margin-bottom of 1em. Inline elements next to paragraphs should have 0.5em of spacing.

BDD

gherkin
Feature: Consistent Paragraph Spacing in Vector 2022

  Scenario: Ensure correct paragraph spacing and inline element spacing
    Given a user is viewing content in the Vector 2022 skin
    When the user views paragraphs and inline elements
    Then the paragraphs should have a margin-top of 0.5em and a margin-bottom of 1em
    And inline elements next to paragraphs should have 0.5em of spacing

Test Steps

Test Case 1: Verify Paragraph and Inline Element Spacing in Vector 2022

  1. Open the Vector 2022 skin.
  2. Navigate to this patch demo page.
  3. Verify the paragraph spacing.
  4. AC1: Confirm that paragraphs have a margin-top of 0.5em and a margin-bottom of 1em.
  5. Verify the inline element spacing next to paragraphs.
  6. AC2: Confirm that inline elements next to paragraphs have 0.5em of spacing.

Acceptance criteria

  • Paragraphs should have margin-top 0.5em and margin-bottom 1em
  • inline elements next to paragraphs should have 0.5 spacing

QA

Communication criteria - does this need an announcement or discussion?

  • no

Rollback plan

  • make sure the change is made in a single patch, so if a revert is needed we can revert that single patch.

QA Results - Beta

ACStatusDetails
1T366389#9873593
2T366389#9873593 this passes per T366389#9877480

QA Results - PROD

ACStatusDetails
1T366389#9895769
2T366389#9895769

Event Timeline

Change #1036715 had a related patch set uploaded (by Bernard Wang; author: Bernard Wang):

[mediawiki/skins/Vector@master] POC: Make paragraph spacing 0.5em top and 1em bottom by default, handle adjacent inline elements manually

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

ovasileva set the point value for this task to 2.Mon, Jun 3, 5:38 PM

Just to double check, @JScherer-WMF these are the inline elements that were handled (ul, ol, table, dl, blockquote) to only have 0.5 top spacing when following a paragraph. Does this initial list of "inline elements" seem good to you? they can be adjusted in the future as well

i.e.

<p>paragraph</p>     
<--- 0.5em margin between paragraph and blockquote (not including spacing on the blockquote itself)
<blockquote>adjacent inline element</blockquote>
<--- 1em margin between paragraph and blockquote
<p>paragraph</p>

Change #1036715 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Make paragraph spacing 0.5em top and 1em bottom by default, handle adjacent inline elements manually

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

Edtadros subscribed.

Test Result - Beta

Status: ❓Need More Info
Environment: Beta
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify Paragraph and Inline Element Spacing in Vector 2022

  1. Open the Vector 2022 skin.
  2. Navigate to this patch demo page.
  3. Verify the paragraph spacing.
  4. AC1: Confirm that paragraphs have a margin-top of 0.5em and a margin-bottom of 1em.

screenshot 603.png (926×1 px, 260 KB)

  1. Verify the inline element spacing next to paragraphs.
  2. AC2: Confirm that inline elements next to paragraphs have 0.5em of spacing.

@bwang, This doesn't look right. What should I be looking for here?

screenshot 607.png (1×1 px, 358 KB)

screenshot 608.png (1×1 px, 362 KB)

screenshot 606.png (1×1 px, 296 KB)

screenshot 605.png (1×1 px, 302 KB)

Another problematic usecase we have on frwiki:

.col {
  margin-top: 0.3em;
  column-width: 30ex;
}
.col ul { margin-top: 0; }
<div class="col">
* list
* with
* several
* elements
* displayed
* in
* several
* columns
</div>

This example does not display consistently on Vector-2022 and Vector-legacy, since Vector-2022 already has margin-top: 0;

This example does not display consistently on Vector-2022 and Vector-legacy, since Vector-2022 already has margin-top: 0;

That will be removed after this patch goes live: https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/1036715/3/resources/skins.vector.styles/typography.less.

ovasileva subscribed.

@JScherer-WMF - could you do a quick review?

  1. Verify the inline element spacing next to paragraphs.
  2. AC2: Confirm that inline elements next to paragraphs have 0.5em of spacing.

@bwang, This doesn't look right. What should I be looking for here?

screenshot 607.png (1×1 px, 358 KB)

screenshot 608.png (1×1 px, 362 KB)

screenshot 606.png (1×1 px, 296 KB)

screenshot 605.png (1×1 px, 302 KB)

Ah, this is a poorly worded requirement. That's the source of the confusion. The requirement should read: "Paragraphs with floated elements beside them always have at least 0.5em vertical spacing."

The issue before was that floated elements "stole" the vertical spacing from the paragraphs within which they appear. @bwang and I decided that the paragraphs should always have at least 0.5em spacing. If a floated element interacts with the end of a paragraph, that means that the spacing might get slightly larger. The spacing between the floated elements themselves is not the primary focus of this patch. Moving this to ready for sign off.

If we discover new, unintended vertical spacing behaviours, we should note them as separate bugs.

Thanks again @Jack_who_built_the_house and @bwang for your collaboration on this!

Test Result - PROD

Status: ✅ PASS
Environment: PROD
OS: macOS Sonoma 14.5
Browser: Chrome 126
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify Paragraph and Inline Element Spacing in Vector 2022

  1. Open the Vector 2022 skin.
  2. Navigate to this patch demo page.
  3. Verify the paragraph spacing.
  4. AC1: Confirm that paragraphs have a margin-top of 0.5em and a margin-bottom of 1em.

2024-06-14_15-03-19.png (1×3 px, 675 KB)

  1. Verify the inline element spacing next to paragraphs.
  2. AC2: Confirm that inline elements next to paragraphs have 0.5em of spacing.

2024-06-14_15-36-40.png (1×3 px, 619 KB)

2024-06-14_15-39-17.png (1×3 px, 622 KB)