Make WordPress Core

Opened 7 weeks ago

Last modified 10 days ago

#63386 new defect (bug)

Twenty Seventeen: Latest Posts block having issue with alignment options

Reported by: nidhidhandhukiya's profile nidhidhandhukiya Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch has-test-info 2nd-opinion
Focuses: Cc:

Description

Steps to reproduce the issue:-

  1. Activate Twenty Seventeen theme.
  2. Choose Latest posts block.
  3. Choose alignment any left, right or center.

In both the editor and front-end, Left and Right alignment show no visible effect. When Center is selected, it aligns only the text on the front-end, not the entire block. This behavior is inconsistent—alignment should apply uniformly across all options for clarity and consistency.

Attachments (7)

latest-post-block-alignment.mp4 (2.0 MB) - added by viralsampat 7 weeks ago.
I have resolved the issue and attached its patch.
63386.patch (1.2 KB) - added by viralsampat 7 weeks ago.
Patch
T17-Latest-Posts-alignright.png (202.2 KB) - added by sabernhardt 10 days ago.
Latest Posts blocks aligned right within page content on the front end, showing how narrow blocks float and how wider blocks have a left margin (without the patch)
T17-Latest-Posts-editor-center-before.png (124.9 KB) - added by sabernhardt 10 days ago.
before patch: Latest Posts, Archives, and Categories Lists blocks set to Align center in the editor
T17-Latest-Posts-front-center-before.png (142.5 KB) - added by sabernhardt 10 days ago.
before patch: the three different blocks centered on the front end
63386.center.patch (814 bytes) - added by sabernhardt 10 days ago.
corrects center alignment in editor (updates selectors, adds text-align to the 3 blocks, and removes padding for Archives block)
T17-Latest-Posts-editor-center-patch.png (126.0 KB) - added by sabernhardt 10 days ago.
centered blocks in editor with 63386.center.patch

Change History (14)

@viralsampat
7 weeks ago

I have resolved the issue and attached its patch.

@viralsampat
7 weeks ago

Patch

#1 @sainathpoojary
7 weeks ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://core.trac.wordpress.org/attachment/ticket/63386/63386.patch

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.28
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 135.0.0.0
  • OS: macOS
  • Theme: Twenty Seventeen 3.9
  • MU Plugins: None activated
  • Plugins: Test Reports 1.2.0

Actual Results

✅ Patch fixes the block alignment issue in Twenty Seventeen. Left, right, and center now work properly in both the editor and front-end.

Supplemental Artifacts

Video: https://rioudcpuyg.ufs.sh/f/PL8E4NiPUWyOGlRpdENEeschquBM6yNU3LCFxWSw4rTfmliR

#2 @darshitrajyaguru97
7 weeks ago

Test Report

Patch tested: https://core.trac.wordpress.org/attachment/ticket/63386/63386.patch

Environment:

OS: Windows 10
PHP: 8.2.12
WordPress: 6.9-alpha-60093-src
Browser: Chrome
Theme: Twenty seventeen
Plugins: None activated

Actual Results:

Before patch:
Screen Recording: https://tinyurl.com/238v2ovs

After patch:
Screen Recording: https://tinyurl.com/28zjr4sn

✅ Patch fixed the block alignment issue

#3 @karmatosed
6 weeks ago

  • Keywords has-patch added

#4 @SirLouen
6 weeks ago

  • Keywords has-test-info dev-feedback added

#5 follow-up: @sabernhardt
6 weeks ago

  • Keywords 2nd-opinion added
  • Summary changed from Twenty Seventeen - Lastes post block having issue in alignnment. to Twenty Seventeen: Latest Posts block having issue with alignment options
  • Version 6.8 deleted

63386.patch proposes to

  1. Align text to the right, on the front end, within Archives, Categories List and Latest Posts blocks that are set to Align right. If this is done, the editor would also need to position the list marker inside.
  2. Assign a text alignment in the editor for potentially any blocks set to Align left, center or right (if the block is inside a div with a data-align attribute).

However, the Left, Center and Right alignment options are intended for aligning the full block, not always aligning the text within them. People might expect the text alignment to change too, but that is not certain.

Personally, I do not find much value in aligning (floating) a Latest Posts block to the left or right, and aligning the text of post content/excerpt paragraphs to the right (or center) can make them more difficult to read.

#6 in reply to: ↑ 5 ; follow-up: @SirLouen
2 weeks ago

  • Keywords dev-feedback removed

Replying to sabernhardt:

Personally, I do not find much value in aligning (floating) a Latest Posts block to the left or right, and aligning the text of post content/excerpt paragraphs to the right (or center) can make them more difficult to read.

I don't really get this.

With the class .allignright I think that this is pretty much what's intended

And with the data-align it's almost the same logic. I'm not a big fan of these patches, but this seems to be pretty straightforward. What is your alternative?

@sabernhardt
10 days ago

Latest Posts blocks aligned right within page content on the front end, showing how narrow blocks float and how wider blocks have a left margin (without the patch)

@sabernhardt
10 days ago

before patch: Latest Posts, Archives, and Categories Lists blocks set to Align center in the editor

@sabernhardt
10 days ago

before patch: the three different blocks centered on the front end

#7 in reply to: ↑ 6 @sabernhardt
10 days ago

I would focus on fixing the center alignment—in the theme's editor styles—and avoid adding styles for .alignright and its data-align counterpart.

With Twenty Seventeen, the 'Align center' option centers the text on the front end for the Latest Posts, Archives and Categories List blocks. The theme also moves any bulleted list markers next to the text. However, the editor does not center text for the Archives or Latest Posts blocks, and the list markers are still on the left for the Categories List block.

I think relatively few sites would use the right and/or left alignment options with this block (I probably would never choose those options). More importantly, any new front-end styles after six years could be inappropriate and unwelcome for some of the sites that already float the block to either side.

@sabernhardt
10 days ago

corrects center alignment in editor (updates selectors, adds text-align to the 3 blocks, and removes padding for Archives block)

@sabernhardt
10 days ago

centered blocks in editor with 63386.center.patch

Note: See TracTickets for help on using tickets.