Opened 9 years ago
Last modified 5 years ago
#32940 new enhancement
Add IDs to Admin Hyperlinks
Reported by: | charlestonsw | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Administration | Keywords: | has-patch needs-testing dev-feedback 2nd-opinion |
Focuses: | Cc: |
Description
Suggestion: add Ids to the primary admin interface hyperlinks.
Adding IDs to primary anchor tags in the admin UI makes it far easier to create and maintain UI test suites such as Selenium IDE. UI testing catches problems that phpUnit is not designed to address.
Example: Pages / Add New
xpath = /html/body/div/div[1]/div[2]/ul/li[5]/ul/li[3]/a
css = html.wp-toolbar body.wp-admin.wp-core-ui.js.edit-php.auto-fold.admin-bar.post-type-page.branch-4-3.version-4-3.admin-color-fresh.locale-en-us.customize-support.sticky-menu.svg div#wpwrap div#adminmenumain div#adminmenuwrap ul#adminmenu li#menu-pages.wp-has-submenu.wp-has-current-submenu.wp-menu-open.menu-top.menu-icon-page ul.wp-submenu.wp-submenu-wrap li a
Would be nice to reference key elements with things like a#menu-page-add-new instead. Especially when updates to WP Core change the higher level HTML DOM classesor structures.
Attachments (1)
Change History (5)
#3
@
5 years ago
- Keywords has-patch added; needs-patch removed
Thank you @charlestonsw for the report.
Likewise thank you @gaurang484 for the patch submission. I'll mark the ticket as has-patch
so it can receive a review.
#4
@
5 years ago
- Keywords needs-testing dev-feedback 2nd-opinion added; good-first-bug removed
- Milestone set to Future Release
32940.diff applies cleanly and seems to do the job, however I am concerned that it uses the menu label as a source for generating the id
attribute, which depends on the used locale.
I've switched WordPress to my native language (not English) and the menu ids also changed. For the purpose requested by the reporter (to be able to address specific menu items by CSS and/or JS), this is not stable enough in my opinion.
Core folks, please chime in with thoughts and suggestions on how to otherwise address this better.
Thanks.
Added code to display ID for sub menu items in admin dashboard