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

WordPress Trac noreply at wordpress.org
Fri Apr 17 07:45:05 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:
--------------------------------------+-----------------------------

Comment (by roytanck):

 Replying to [comment:9 SergeyBiryukov]:
 > 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.

 I'd probably go for a data attribute instead of an id if we're going to
 add the path. Like is done on the <tr> element.

 > 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"].

 I've tested your patch, and it works perfectly for me. Elegant solution,
 although at the expense of a little additional code. I prefer this
 solution over using the path.

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


More information about the wp-trac mailing list