jquery.makeCollapsible: Togglers accessibility
authorMatmaRex <matma.rex@gmail.com>
Sun, 7 Jul 2013 18:26:28 +0000 (20:26 +0200)
committerMatmaRex <matma.rex@gmail.com>
Sun, 7 Jul 2013 18:26:28 +0000 (20:26 +0200)
Use tabindex="0" and role="button" for all togglers, custom or not.

Bug: 17616
Change-Id: If59590de159a2756bf5b859ce48a23e1af7650fa

resources/jquery/jquery.makeCollapsible.js

index 2823174..3a6c1b1 100644 (file)
                                }
                        }
 
+                       // Attributes for accessibility. This isn't necessary when the toggler is already
+                       // an <a> or a <button> etc., but it doesn't hurt either, and it's consistent.
+                       $toggleLink.prop( 'tabIndex', 0 ).attr( 'role', 'button' );
+
                        // Initial state
                        if ( options.collapsed || $collapsible.hasClass( 'mw-collapsed' ) ) {
                                // Remove here so that the toggler goes in the right direction (the class is re-added)