WordPress.org

Make WordPress Core

#47536 closed defect (bug) (fixed)

More actions not aligned correctly

Reported by: Presskopp Owned by: SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: minor Version: 5.3
Component: Administration Keywords: needs-patch has-screenshots dev-feedback
Focuses: Cc:

Description

"Manage ..." has a leading space, see screenshot

Attachments (1)

space.jpg (38.5 KB) - added by Presskopp 10 months ago.

Download all attachments as: .zip

Change History (6)

@Presskopp
10 months ago

#1 @davidbaumwald
10 months ago

  • Keywords has-screenshots added

#2 @davidbaumwald
10 months ago

  • Keywords dev-feedback added

This is a product of the unique HTML structure of that specific line. In the first list element, a <div class="welcome-icon welcome-widgets-menus"> wraps text containing multiple <a> tags. Therefore, the icon pseudo-element ::before for that row is applied to the div.

Conversely, the other lines on the Next Steps and More Actions sections contain only one a, and in those cases, the ::before is applied to that element.

Here's the relevant section from wp-admin/includes/dashboard.php, starting on line 1716:

<ul>
<?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?>
	<li><div class="welcome-icon welcome-widgets-menus">
	<?php
	if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) {
		printf(
			__( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ),
			admin_url( 'widgets.php' ),
			admin_url( 'nav-menus.php' )
		);
	} elseif ( current_theme_supports( 'widgets' ) ) {
		echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>';
	} else {
		echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>';
	}
	?>
	</div></li>
<?php endif; ?>
<?php if ( current_user_can( 'manage_options' ) ) : ?>
	<li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li>
<?php endif; ?>
	<li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li>
</ul>

Coding Standards dictate that opening/closing PHP tags shall appear on their own lines. With CSS adding the ::before pseudo-element for the icon to <div class="welcome-icon welcome-widgets-menus">, the whitespace created between lines 1717 and 1718 is rendered.

Line 1726 and 1728 have PHP rendering singular <a> tags and there's no whitespace because Coding Standards allow for single-line mixtures of HTML and PHP.

Hopefully this breaks down the root cause of the issue. This first appeared from [42343] stemming from ticket #41057.

Last edited 10 months ago by davidbaumwald (previous) (diff)

#3 @davidbaumwald
10 months ago

  • Version set to trunk

#4 @SergeyBiryukov
10 months ago

  • Milestone changed from Awaiting Review to 5.3

#5 @SergeyBiryukov
10 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 45536:

Administration: Adjust code for "Manage widgets or menus" item on "Welcome to WordPress" panel to avoid an extra space after [42343].

Props Presskopp, davidbaumwald.
Fixes #47536.

Note: See TracTickets for help on using tickets.