Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collapsible paper: wrong IDs #10326

Open
afercia opened this issue Jul 11, 2018 · 0 comments
Open

Collapsible paper: wrong IDs #10326

afercia opened this issue Jul 11, 2018 · 0 comments

Comments

@afercia
Copy link
Contributor

afercia commented Jul 11, 2018

See the collapsible papers introduced in #10264.

Passing the HTML output of the Search appearance page through the W3C validator highlights a few occurrences of invalid ID attributes.

Note: I'm testing with WooCommerce activated so I get also the Woo post / taxonomies.

1
empty IDs are invalid: there are 7 occurrences of:
<div class="paper tab-block" id="">

Where the ID is supposed to be the paper ID, which is null by default:
<div class="paper tab-block" id="<?php echo esc_attr( $paper_id ); ?>">

Not sure why the "paper tab-block" needs an ID in the first place, however either we should always pass a paper_id or ensure the ID doesn't get printed out if paper_id is null.

2
IDs can't contain spaces:
The collapsible headings H2 have an ID that is sometimes set to a title passed via a config array or set manually as first parameter passed to WPSEO_Paper_Presenter. See for example admin/views/tabs/metas/archives.php. In one case it's an empty string (general.php). In other cases, it's set to be the post or taxonomy name (to clarify: the $object->labels->name). The passed string may contain spaces and in this case it's an invalid ID. Current occurrences:

<h2 class="help-button-inline" id="Posts">
<h2 class="help-button-inline" id="Pages">
<h2 class="help-button-inline" id="Products">
<h2 class="help-button-inline" id="Categories">
<h2 class="help-button-inline" id="Tags">
<h2 class="help-button-inline" id="Formats">
<h2 class="help-button-inline" id="Product categories">
<h2 class="help-button-inline" id="Product tags">
<h2 class="help-button-inline" id="Product shipping classes">
<h2 class="help-button-inline" id="Author archives settings">
<h2 class="help-button-inline" id="Date archives settings">
<h2 class="help-button-inline" id="Special Pages">

Worth noting setting sections that are not collapsible don't use an ID on the heading. Regardless, I'm not sure what this ID is meant for in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants