mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Customizer: Avoid losing focus when adding widgets via keyboard.
props sathishn. fixes #28835. git-svn-id: https://develop.svn.wordpress.org/trunk@29237 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
bcff52c1b0
commit
7a01c6af7b
@ -316,10 +316,13 @@
|
||||
isEsc = ( event.which === 27 ),
|
||||
isDown = ( event.which === 40 ),
|
||||
isUp = ( event.which === 38 ),
|
||||
isTab = ( event.which === 9 ),
|
||||
isShift = ( event.shiftKey ),
|
||||
selected = null,
|
||||
firstVisible = this.$el.find( '> .widget-tpl:visible:first' ),
|
||||
lastVisible = this.$el.find( '> .widget-tpl:visible:last' ),
|
||||
isSearchFocused = $( event.target ).is( this.$search );
|
||||
isSearchFocused = $( event.target ).is( this.$search ),
|
||||
isLastWidgetFocused = $( event.target ).is( '.widget-tpl:visible:last' );
|
||||
|
||||
if ( isDown || isUp ) {
|
||||
if ( isDown ) {
|
||||
@ -357,6 +360,11 @@
|
||||
} else if ( isEsc ) {
|
||||
this.close( { returnFocus: true } );
|
||||
}
|
||||
|
||||
if ( isTab && ( isShift && isSearchFocused || ! isShift && isLastWidgetFocused ) ) {
|
||||
this.currentSidebarControl.container.find( '.add-new-widget' ).focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user