WordPress.org

Make WordPress Core

Opened 17 months ago

Closed 3 months ago

#22712 closed defect (bug) (fixed)

Admin using deprecated valign attribute

Reported by: josh401 Owned by: azaozz
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.4.2
Component: Template Keywords: has-patch
Focuses: Cc:

Description

Hi,

I noticed when I validated one of my plugins' admin pages, I received approx. 40 error messages regarding the use of "v-align:top;" within the css structure. (Please see attached screenshot)

Is there a way to use a different css to target these elements instead of the deprecated v-align usage?

Thanks!

Attachments (7)

trac1.png (80.2 KB) - added by josh401 17 months ago.
Screenshot of deprecated v-align validation errors
trac2-validation-error-valign.png (76.7 KB) - added by josh401 16 months ago.
validation error 'valign'
22712.diff (539 bytes) - added by MikeHansenMe 16 months ago.
remove valign="top" from do_settings_fields called by do_settings_sections
trac3-valign-fixed.png (74.9 KB) - added by josh401 16 months ago.
valign fixed validation report
22712.markup.diff (42.5 KB) - added by MikeHansenMe 15 months ago.
this removes all the markup pages need to be checked to see if any additional css is needed
22712 - markup and styles.diff (274.3 KB) - added by Marventus 15 months ago.
22712-class-wp-posts-list-table.php.diff (591 bytes) - added by neoxx 3 months ago.

Download all attachments as: .zip

Change History (39)

josh40117 months ago

Screenshot of deprecated v-align validation errors

comment:1 SergeyBiryukov17 months ago

  • Component changed from Warnings/Notices to Validation

comment:2 josh40117 months ago

Sorry, just wanted to clarify (can't seem to find an edit button).

The initial usage resulting in the notices is v-align="top", displayed in the HTML structure of the rendered page.

comment:3 MikeHansenMe16 months ago

  • Cc mdhansen@… added

@josh401 did you call a function in your plugin that produced this invalid code? If so what one. This code can be found throughout the admin core code. Just to clarify because I first thought this was a problem with your plugin based on the screenshot.

Also related: #16135

Last edited 16 months ago by SergeyBiryukov (previous) (diff)

comment:4 follow-up: josh40116 months ago

@MikeHansenMe,

I don't think so. I'm not very fond of tables... and I think I'd remember if I used that particular invalid HTML. I just went back through my admin panel code... and no traces of any usage of v-align="top".

I'll try and find another plugin which is using the same code as me for displaying admin panel options... and see if the same thing happens there.

I don't think it's my plugin. I think it's how the core code produces the tables when using the callback functions I use. But, I could be wrong.. (and would hate to be). So, I'll seek out another plugin which behaves the same... and report back.

Last edited 16 months ago by josh401 (previous) (diff)

comment:5 in reply to: ↑ 4 ; follow-up: SergeyBiryukov16 months ago

Replying to josh401:

I just went back through my admin panel code... and no traces of any usage of v-align="top".

Note that it's valign, not v-align.

Replying to MikeHansenMe:

This code can be found throughout the admin core code.

Core indeed uses <tr valign="top"> in 12 files. In HTML5, the valign attribute on the tr element is obsolete. W3C recommends to use CSS instead: http://www.w3.org/TR/html-markup/tr.html

comment:6 josh40116 months ago

@SergeyBiryukov,

Thanks for the clarification. Just checked.. no traces of valign either.

Searching for another plugin to replicate now...

comment:7 in reply to: ↑ 5 bpetty16 months ago

  • Cc bpetty added
  • Milestone changed from Awaiting Review to Future Release

Replying to SergeyBiryukov:

Core indeed uses <tr valign="top"> in 12 files. In HTML5, the valign attribute on the tr element is obsolete. W3C recommends to use CSS instead: http://www.w3.org/TR/html-markup/tr.html

It's actually also used with table cells (td) and table headers (th), so I see 96 matches across 18 PHP files, as well as in the wp-includes/js/tinymce/plugins/wpeditimage/editimage.html template file.

Last edited 16 months ago by bpetty (previous) (diff)

comment:8 josh40116 months ago

Here is another plugin which doesn't seem to have the valign in the source code of the plugin. This is "scripts and styles".
http://wordpress.org/extend/plugins/scripts-n-styles/

(Screenshot attached) (trac2-validation-error-valign.png)

josh40116 months ago

validation error 'valign'

MikeHansenMe16 months ago

remove valign="top" from do_settings_fields called by do_settings_sections

comment:9 MikeHansenMe16 months ago

  • Keywords has-patch added

That patch should solve the problem but as mentioned above there are about 95 other instances throughout core that also need to be fixed.

comment:10 josh40116 months ago

@MikeHansenMe,

Thanks. Will test now and post back a new screenshot.

comment:11 josh40116 months ago

It was line 1149 for me? Not sure why? Did you use WP 3.5? This screenshot is using WP 3.4.2.

Brilliant!! It worked. All I'm left with are these 'nonce' errors (Screenshot attached). Should I begin a new trac ticket... or am I doing something wrong?

Thank you for your immediate attention and solution!

josh40116 months ago

valign fixed validation report

comment:12 bpetty16 months ago

  • Summary changed from Plugins admin pages options using v-align top to Admin using deprecated valign attribute

It would be best if each of these types of issues (specifically referring to validation errors) were handled individually on new tickets.

comment:13 neoxx15 months ago

  • Cc mail@… added

In addition to the current patch I'd suggest we also remove the deprecated code for all occurrences of valign="top" in wp-admin:

./wp-admin/comment.php (in this file the usage is inconsistent)
./wp-admin/custom-background.php
./wp-admin/custom-header.php
./wp-admin/edit-form-comment.php
./wp-admin/edit-tag-form.php
./wp-admin/includes/class-wp-media-list-table.php
./wp-admin/includes/class-wp-ms-sites-list-table.php
./wp-admin/includes/class-wp-posts-list-table.php
./wp-admin/includes/file.php
./wp-admin/includes/media.php
./wp-admin/includes/template.php
./wp-admin/my-sites.php
./wp-admin/network/settings.php
./wp-admin/options-discussion.php
./wp-admin/options-general.php
./wp-admin/options-media.php
./wp-admin/options-privacy.php
./wp-admin/options-reading.php
./wp-admin/options-writing.php

comment:14 bpetty15 months ago

  • Keywords needs-patch added; has-patch removed

Right, this does need an extensive patch removing all occurrences of the valign attribute and adding the equivalent CSS styles to those same locations.

comment:15 follow-up: josh40115 months ago

I have no experience with core development... but, I'm fairly educated with code and plugin development. If I can help in any way whatsoever, please let me know.

Thank you.

comment:16 in reply to: ↑ 15 azaozz15 months ago

Looking at the places where valign is used, seems all are left over from long ago. Also about half are overwritten with css already.

Replying to josh401:

I have no experience with core development...

All that's needed here is to remove the attributes and then check the affected screens and add a little of css to keep the table cells aligned to the top (most valign attributes are on <tr>).

Thinking such patch would be a good way to "get your feet wet" :)

comment:17 follow-up: josh40115 months ago

Thinking such patch would be a good way to "get your feet wet" :)

Thanks Andrew. Do you have any links you can point me to on how to get started?

comment:18 in reply to: ↑ 17 SergeyBiryukov15 months ago

Replying to josh401:

Do you have any links you can point me to on how to get started?

Take a look at http://make.wordpress.org/core/handbook/submitting-a-patch/.

comment:19 josh40115 months ago

Thanks, Sergey.

Please allow me 24 to 48 hours to familiarize myself with the process, and I'll be back with a patch.

MikeHansenMe15 months ago

this removes all the markup pages need to be checked to see if any additional css is needed

comment:20 follow-up: Marventus15 months ago

  • Keywords has-patch added; needs-patch removed

Hello. I am working with Josh in the Ultimate Tinymce plugin project.
Here's a diff that takes care of the styles issue. Basically, I replaced all instances of valign ("top", "middle", and "bottom" -- no "baseline" values used) with corresponding css classes ("aligntop", "alignmiddle", "alignbottom") and added these classes to the wp-admin/css/admin.css and wp-admin/css/admin.min.css files. I think this should resolve the problem but additional testing would be great.
Cheers!

comment:21 in reply to: ↑ 20 SergeyBiryukov15 months ago

Replying to Marventus:

There's no need to patch minified files, a post-commit bot takes care of that.

comment:22 josh40115 months ago

Thank you, everyone! @Marventus... thanks for the help! @MikeHansenMe.. thank you very much! I thoroughly love and appreciate everything here. It is so nice to work with professionals!

comment:23 MikeHansenMe15 months ago

After taking a quick check around the admin, I could not see anywhere that the alignment was off. It may be worth going through more to determine if we need to add aligntop, alignmiddle, or alignbottom classes or if it is adding unnecessary code.

comment:24 Marventus15 months ago

@Josh, no pb!
@Mike, I noticed the exact same thing, but to be honest, I was afraid of just not leaving anything in case there's something I was missing. That's why I submitted another diff (I hope you don't mind, ;-) ).

Last edited 15 months ago by Marventus (previous) (diff)

comment:25 nacin3 months ago

  • Component changed from Validation to Template

comment:26 josh4013 months ago

Great to see this get some attention. I was JUST NOW working in the admin and noticed this was still prevalent.

Thanks Andrew!

comment:27 azaozz3 months ago

Looking at this again: most of the valign are in table.widefat or table.form-table. There is already vertical alignment for th and td in css for both tables.

Don't think we need to add new alignment classes. Better to remove all valign and if something goes out of vertical alignment, can target it directly in css.

Last edited 3 months ago by azaozz (previous) (diff)

comment:28 josh4013 months ago

Better to remove all valign and if something goes out of vertical alignment, can target it directly in css.

Absolutely agreed. The table.form-table is where the majority of the ones I see exist. I use it pretty consistently, and have never had a need to vertically align anything in that <tr> element. If I did, I'd do as you said with the CSS. I certainly wouldn't mind to see it go :)

comment:29 azaozz3 months ago

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

In 27029:

Remove all "valign" attributes from tables in wp-admin, props MikeHansenMe, Marventus. Fixes #22712.

comment:30 azaozz3 months ago

  • Milestone changed from Future Release to 3.9

comment:31 neoxx3 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I think you've forgotten one occurrence. - Patch (22712-class-wp-posts-list-table.php.diff) is attached.

comment:32 azaozz3 months ago

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

In 27037:

Remove one more valign, props neoxx, fixes #22712.

Note: See TracTickets for help on using tickets.