[wp-trac] [WordPress Trac] #46964: ID attribute value are used multiple times in "Custom Field" form
WordPress Trac
noreply at wordpress.org
Fri Jan 31 19:28:11 UTC 2020
#46964: ID attribute value are used multiple times in "Custom Field" form
-------------------------------------------------+-------------------------
Reporter: jankimoradiya | Owner: audrasjb
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.4
Component: Editor | Version: 5.0
Severity: normal | Resolution:
Keywords: has-screenshots has-patch early | Focuses: ui,
commit needs-dev-note | accessibility
-------------------------------------------------+-------------------------
Comment (by sageshilling):
@donmhico mentioned
CSS IDs should be unique in the page as having multiple ones may lead to
unexpected errors.
_______________________________________________________________________________________________
Based on above, let's add dynamic id, so they are not the the same,
counted by the content loop.
main file that needs updating, according to the report is the post.php
wordpress\wp-admin\includes\post.php
2 line change from this:
<div id="poststuff" class="sidebar-open">
<div id="postbox-container-2" class
="postbox-container">
to this:
<div id="poststuff_<?php echo esc_attr( $uniq_id ); ?>" class="sidebar-
open">
<div id="postbox-container_<?php echo
esc_attr( $uniq_id ); ?>" class="postbox-container">
*****
add dynamic derived $uniq_id, from count relative to the content loop
to content loop
in the beginning $uniq_id
set to 0
count function
end of loop $uniq_id++
with plugins, I use the filter 'the_content',
with possible logic to filter on pages needed
**
css (believe the css sheets would need to be updated- edit.css, ie.css)
THIs I haven't tried, yet should work, advisement welcomed
CSS [attribute&circ="value"] Selector
(&circ is the carrot entity)
The [attribute&circ="value"] selector is used to select elements whose
attribute value begins with a specified value.
The following example selects all elements with a id attribute value that
begins with "poststuff_" and "postbox-container_":
Note: The value does not have to be a whole word!
https://www.w3schools.com/css/css_attribute_selectors.asp
from this:
#poststuff_
#postbox-container-2_
to this:
[idˆ="poststuff_"] {
sample: yellow;
}
[idˆ="postbox-container_"] {
sample: yellow;
}
***************************************
propose upping variable to prefix core:
from this:
#poststuff_
#postbox-container-2_
to this something like this (definitely to discuss):
#core_poststuff_
#core_postbox-container-2_
****
research
found on
wordpress\wp-admin\includes\dashboard.php
doesn't appear to need update, according to notes above and see below that
the ids are different
<div id="postbox-container-1" class="postbox-container">
<div id="postbox-container-2" class="postbox-container">
<div id="postbox-container-3" class="postbox-container">
<div id="postbox-container-4" class="postbox-container">
**
need to look at more:
edit-form-advanced.php
edit-form-comment.php
edit-link-form.php
postbox.js
edit.css
ie.css
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46964#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list