Skip to content

Commit 4e0e460

Browse files
committed
Administration: Move tabindex="-1" from notice to JS.
In a handful of admin notices, a `tabindex` attribute is set so that JS can move focus to the notice `div`. Rather than adding `tabindex` to globally accepted attributes for `wp_kses_post()`, move the assignment of `tabindex` into the JS handlers that display those notices. The attribute is only relevant if JS is running, so there is no reason to add it in the original HTML notice. Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600], [56601]. Props costdev, joedolson. See #57791. git-svn-id: https://develop.svn.wordpress.org/trunk@56602 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1e11c3f commit 4e0e460

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/js/_enqueues/admin/application-passwords.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
name: response.name,
6161
password: response.password
6262
} ) );
63-
$( '.new-application-password-notice' ).trigger( 'focus' );
63+
$( '.new-application-password-notice' ).attr( 'tabindex', '-1' ).trigger( 'focus' );
6464

6565
$appPassTbody.prepend( tmplAppPassRow( response ) );
6666

src/js/_enqueues/lib/image-edit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@
858858
elementToSetFocusTo = $( '.imgedit-wrap' ).find( ':tabbable:first' );
859859
}
860860

861-
elementToSetFocusTo.trigger( 'focus' );
861+
elementToSetFocusTo.attr( 'tabindex', '-1' ).trigger( 'focus' );
862862
}, 100 );
863863
},
864864

src/wp-admin/includes/image-edit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ function wp_image_editor( $post_id, $msg = false ) {
3939

4040
if ( $msg ) {
4141
if ( isset( $msg->error ) ) {
42-
$note = "<div class='notice notice-error' tabindex='-1' role='alert'><p>$msg->error</p></div>";
42+
$note = "<div class='notice notice-error' role='alert'><p>$msg->error</p></div>";
4343
} elseif ( isset( $msg->msg ) ) {
44-
$note = "<div class='notice notice-success' tabindex='-1' role='alert'><p>$msg->msg</p></div>";
44+
$note = "<div class='notice notice-success' role='alert'><p>$msg->msg</p></div>";
4545
}
4646
}
4747

src/wp-admin/user-edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@
965965

966966
<?php if ( isset( $application_passwords_list_table ) ) : ?>
967967
<script type="text/html" id="tmpl-new-application-password">
968-
<div class="notice notice-success is-dismissible new-application-password-notice" role="alert" tabindex="-1">
968+
<div class="notice notice-success is-dismissible new-application-password-notice" role="alert">
969969
<p class="application-password-display">
970970
<label for="new-application-password-value">
971971
<?php

0 commit comments

Comments
 (0)