Skip to content

Commit eeb7d1a

Browse files
committed
Restore focus management
PR removed this; needed for accessibility.
1 parent 4dcc14c commit eeb7d1a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/js/_enqueues/admin/tags.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ jQuery( function($) {
4949
var message;
5050
if ( '1' == r ) {
5151
$('#ajax-response').empty();
52+
let nextFocus = tr.next( 'tr' ).find( 'a.row-title' );
53+
let prevFocus = tr.prev( 'tr' ).find( 'a.row-title' );
54+
// If there is neither a next row or a previous row, focus the tag input field.
55+
if ( nextFocus.length < 1 && prevFocus.length < 1 ) {
56+
nextFocus = $( '#tag-name' ).trigger( 'focus' );
57+
} else {
58+
if ( nextFocus.length < 1 ) {
59+
nextFocus = prevFocus;
60+
}
61+
}
5262
tr.fadeOut('normal', function() {
5363
tr.remove();
5464

0 commit comments

Comments
 (0)