diff --git a/js/src/dropdown.js b/js/src/dropdown.js index f947d2aa11..e4c2a11f6d 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -109,11 +109,15 @@ const Dropdown = (($) => { return false } - this.focus() + //this.focus() this.setAttribute('aria-expanded', 'true') - + + + // patch to select by default first item + $(parent).toggleClass(ClassName.OPEN) $(parent).trigger($.Event(Event.SHOWN, relatedTarget)) + $(this).parent().find('.dropdown-menu a:first-child').focus() return false } @@ -203,6 +207,7 @@ const Dropdown = (($) => { } static _dataApiKeydownHandler(event) { + console.log('_dataApiKeydownHandler') if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) { return @@ -259,7 +264,11 @@ const Dropdown = (($) => { } - + // set default acessibility Attributes + $( document ).ready( function () { + $('.dropdown-menu').attr('role','menu') + $('.dropdown-menua a.dropdown-item').attr('role','menuitem') + }) /** * ------------------------------------------------------------------------ * Data Api implementation diff --git a/js/tests/visual/dropdown.html b/js/tests/visual/dropdown.html index f0d6f159e0..964df17e50 100644 --- a/js/tests/visual/dropdown.html +++ b/js/tests/visual/dropdown.html @@ -22,13 +22,13 @@

Dropdown Bootstrap Visual Test