[wp-trac] [WordPress Trac] #62625: Checkboxes under the popular-category class in the category checklist behave unexpectedly.

WordPress Trac noreply at wordpress.org
Mon Dec 2 07:48:49 UTC 2024


#62625: Checkboxes under the popular-category class in the category checklist
behave unexpectedly.
--------------------------+-----------------------------
 Reporter:  elisavet2ww   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  6.7.1
 Severity:  major         |   Keywords:  has-dev-note
  Focuses:                |
--------------------------+-----------------------------
 Selecting or interacting with certain categories inadvertently checks or
 unchecks unrelated checkboxes within the hierarchy. For examle the
 category has the id 25 and every category that includes number 25 will be
 trigger, like 258, 250, 251 etc.

 The problem exist even i have disable all plugins and by using theme
 Twenty Twenty-Five.
 The problem is reproducible in multiple browsers (e.g., Chrome, Firefox).

 **Steps to Reproduce**
 1. Create a category item and check it's id - example "1", ensure that it
 will have the class "popular-category."
 2. Create another category (or subcategory) that will have id that starts
 with number 1, like 13
 3. Attempt to select the category with id 1 when creating a new post, you
 will see that category with id 13 will be also checked.

 **The issue appears to stem from this part of the script post.min.js**

 and this part of code:

 {{{
 h("#" + a + "checklist, #" + a + "checklist-pop").on("click", 'li.popular-
 category > label input[type="checkbox"]', function() {
     var t = h(this),
         e = t.is(":checked"),
         i = t.val();
     i && t.parents("#taxonomy-" + a).length && (h('input[id^="in-' + a +
 "-" + i + '"]').prop("checked", e),
     h("input#in-popular-" + a + "-" + i).prop("checked", e))
 });

 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62625>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list