[wp-trac] [WordPress Trac] #62122: tabindex attribute with the filter widget.

WordPress Trac noreply at wordpress.org
Thu Sep 26 13:54:27 UTC 2024


#62122: tabindex attribute with the filter widget.
-------------------------------------------+-----------------------------
 Reporter:  jannevdwerf                    |      Owner:  (none)
     Type:  defect (bug)                   |     Status:  new
 Priority:  normal                         |  Milestone:  Awaiting Review
Component:  Script Loader                  |    Version:  6.6.2
 Severity:  minor                          |   Keywords:  dev-feedback
  Focuses:  ui, accessibility, javascript  |
-------------------------------------------+-----------------------------
 So I am working on a project, Next Generation Internet and we value
 accessibility very much. So much that we found a small problem in our
 site. [https://ngi.aimsites.nl/resources/].
 When tabbing in the filter sidebar, we select the checkbox and label.
 Which both link to the same website, bus are seen as 2 of different
 inputs. Now I wanted to hardcode a tabindex="-1" inside those <a> with a
 simple script:

 {{{
 var filterBar = document.getElementById('secondary');
 var links = filterBar.getElementsByTagName('a');
 for (var i = 0; i  <  links.length; i++) {
 links[i].setAttribute('tabindex', '-1'); }
 }}}

 But that doesn't seem to fix the problem because you have such a good
 programmed plugin. So  now I have the question if you could fix that
 problem. Maybe have an option for it to disable something like that?
 Nevertheless, thank you for such a great plugin.
 {{{
 if (wpa.tabindex) {
             var q =
 t("input,a,select,textarea,button").not("a:not([href])")
               , A = 0;
             q.each(function() {
                 var i = t(this).attr("tabindex");
                 i && (t(this).removeAttr("tabindex"),
                 A++)
             }),
             A > 0 && (wpa.errors || wpa.tracking) && (a.push(["control-
 tabindex", A]),
             console.log(A + " tabindex attributes removed from links,
 buttons and inputs by WP Accessibility"));
             var k = t('div[role="button"]').not("div[tabindex]")
               , _ = t('a[role="button"]').not("a[tabindex],a[href]");
             k.attr("tabindex", "0").addClass("wpa-focusable"),
             k.length > 0 && (wpa.errors || wpa.tracking) && (a.push
 (["button-add-tabindex", k.length]),
             console.log(k.length + " tabindex attributes added to divs
 with the button role by WP Accessibility")),
             _.attr("tabindex", "0").addClass("wpa-focusable"),
             _.length > 0 && (wpa.errors || wpa.tracking) && (a.push
 (["link-add-tabindex", _.length]),
             console.log(_.length + " tabindex attributes added to anchor
 elements with the button role and no href value by WP Accessibility"))
         }
 }}}
 Inside file: wp-accessibility.min.js?ver=2.1.7

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


More information about the wp-trac mailing list