[wp-trac] [WordPress Trac] #49916: Add id attributes to the plugin activate/deactivate buttons

WordPress Trac noreply at wordpress.org
Fri Apr 17 06:51:56 UTC 2020


#49916: Add id attributes to the plugin activate/deactivate buttons
--------------------------------------+-----------------------------
 Reporter:  shooper                   |       Owner:  SergeyBiryukov
     Type:  enhancement               |      Status:  reopened
 Priority:  normal                    |   Milestone:  5.5
Component:  Plugins                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * keywords:  good-first-bug needs-patch => good-first-bug has-patch


Comment:

 Replying to [comment:8 roytanck]:
 > Any ideas how to fix the duplicate id issue?

 Using the plugin's directory and file name would give us unique IDs:
 {{{
 activate-akismet/akismet.php
 activate-akismet-old/akismet.php
 }}}
 These are technically valid in HTML5, however, as explained in
 [https://stackoverflow.com/questions/70579/what-are-valid-values-for-the-
 id-attribute-in-html/79022#79022 this Stack Overflow answer], the dot
 might need to be escaped when using these IDs.

 For the purpose of fixing this edge case, I think it would be enough to
 save the IDs previously displayed on the page in a static array, and then
 add an incrementing suffix if we find a duplicate, same as
 `wp_unique_post_slug()` does:
 {{{
 activate-akismet
 activate-akismet-2
 }}}

 Something like [attachment:"49916.2.diff"].

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49916#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list