mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: menu focus reset when menu is closed, prevents issues when using keyboard control on button when focusing menu item before
This commit is contained in:
parent
75cfcf2235
commit
640d3080eb
7
ui/jquery.ui.selectmenu.js
vendored
7
ui/jquery.ui.selectmenu.js
vendored
@ -137,7 +137,7 @@ $.widget( "ui.selectmenu", {
|
|||||||
focus: function( event, ui ) {
|
focus: function( event, ui ) {
|
||||||
var item = ui.item.data( "ui-selectmenu-item" );
|
var item = ui.item.data( "ui-selectmenu-item" );
|
||||||
// prevent inital focus from firing and checks if its a newly focused item
|
// prevent inital focus from firing and checks if its a newly focused item
|
||||||
if ( that.focus !== undefined && item.index !== that.focus ) {
|
if ( !that.isOpen && that.focus !== undefined && item.index !== that.focus ) {
|
||||||
that._trigger( "focus", event, { item: item } );
|
that._trigger( "focus", event, { item: item } );
|
||||||
if ( !that.isOpen ) {
|
if ( !that.isOpen ) {
|
||||||
that._select( item, event );
|
that._select( item, event );
|
||||||
@ -206,7 +206,10 @@ $.widget( "ui.selectmenu", {
|
|||||||
|
|
||||||
// check if we have an item to select
|
// check if we have an item to select
|
||||||
if ( this.menuItems ) {
|
if ( this.menuItems ) {
|
||||||
var id = this._getSelectedItem().find( "a" ).attr( "id" );
|
var item = this._getSelectedItem(),
|
||||||
|
id = item.find( "a" ).attr( "id" );
|
||||||
|
|
||||||
|
this.menu.menu( "focus", null, item );
|
||||||
this.button.attr( "aria-activedescendant", id );
|
this.button.attr( "aria-activedescendant", id );
|
||||||
this.menu.attr( "aria-activedescendant", id );
|
this.menu.attr( "aria-activedescendant", id );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user