WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#42221 closed defect (bug) (fixed)

Code Editors: remove redundant padding in RTL view

Reported by: ramiy Owned by: westonruter
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.9
Component: Administration Keywords: has-screenshots has-patch
Focuses: ui, rtl Cc:

Description

The new theme/plugin file list has a redundant padding in RTL view.

See the attached screenshots.

Attachments (3)

42221-ltr.png (153.7 KB) - added by ramiy 2 years ago.
42221-rtl.png (138.5 KB) - added by ramiy 2 years ago.
42221.0.diff (1.7 KB) - added by westonruter 2 years ago.

Download all attachments as: .zip

Change History (9)

@ramiy
2 years ago

@ramiy
2 years ago

#1 @ramiy
2 years ago

  • Keywords has-screenshots needs-patch added

#2 @afercia
2 years ago

  • Component changed from General to Administration
  • Focuses ui added; administration removed
  • Milestone changed from Awaiting Review to 4.9

plugin-editor-php and theme-editor-php set an inline style on the first level list:
<ul role="group" style="padding-left: 0;">

Inline styles with properties involving left/right values are no good for RTL because the build process for RTL processes just the CSS files, not inline styles in the markup. This CSS declaration should be set in a CSS file, properly targeting the first level <ul>. /cc @WraithKenny

On a side note, WordPress doesn't do the following type of indentation in the PHP files:

	<ul role="tree" aria-labelledby="theme-files-label">
		<li role="treeitem" tabindex="-1" aria-expanded="true"
			aria-level="1"
			aria-posinset="1"
			aria-setsize="1">
			<ul role="group" style="padding-left: 0;">
				<?php wp_print_theme_file_tree( wp_make_theme_file_tree( $allowed_files ) ); ?>
			</ul>
		</li>
	</ul>

This is PHP, not JS, and indenting code this way actually produces a lot of white space in the markup.

#3 @westonruter
2 years ago

The indentation of the element attributes is just for increased readability and maintainability of the PHP code that prints out the HTML. The coding standards have a one-PHP-code-block-per-line sniff. The same was done recently for the Customizer controls. So I don't think necessarily that WordPress doesn't do it, but in contrast I think it often should.

Last edited 2 years ago by westonruter (previous) (diff)

#4 @westonruter
2 years ago

Correction: I realized that this code here isn't outputting attributes via PHP, so they could be on the same line no problem.

@westonruter
2 years ago

#5 @westonruter
2 years ago

  • Keywords has-patch added; needs-patch removed
  • Owner set to westonruter
  • Status changed from new to accepted

#6 @westonruter
2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 41865:

File Editor: Move inline to external style to fix extra padding in RTL page direction.

Props afercia.
Fixes #42221.

Note: See TracTickets for help on using tickets.