From d932659aba34e5fc38af663a346f42311a98408f Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Sat, 24 Jun 2023 14:30:31 +0000 Subject: [PATCH] Editor: Improve accessibility of new custom field UI. Add labels; change Enter new/Cancel link to a button; move focus to input when creating new field; move Add Custom Field out of fields table. Props jane, batmoo, karmatosed, franrosa, sabernhardt, annashopina, oglekler, joedolson. Fixes #15631. git-svn-id: https://develop.svn.wordpress.org/trunk@56018 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/lib/lists.js | 2 +- src/wp-admin/css/edit.css | 7 ++++++- src/wp-admin/includes/template.php | 26 ++++++++++---------------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/js/_enqueues/lib/lists.js b/src/js/_enqueues/lib/lists.js index 70e054fda8..d7e888c85b 100644 --- a/src/js/_enqueues/lib/lists.js +++ b/src/js/_enqueues/lib/lists.js @@ -747,7 +747,7 @@ wpList = { return list.wpList.add( this ); } ); - $element.on( 'click', 'a[data-wp-lists^="add:' + list.id + ':"], input[data-wp-lists^="add:' + list.id + ':"]', function() { + $element.on( 'click', '[data-wp-lists^="add:' + list.id + ':"], input[data-wp-lists^="add:' + list.id + ':"]', function() { return list.wpList.add( this ); } ); diff --git a/src/wp-admin/css/edit.css b/src/wp-admin/css/edit.css index 2033113664..f808cf1c7f 100644 --- a/src/wp-admin/css/edit.css +++ b/src/wp-admin/css/edit.css @@ -1068,6 +1068,10 @@ form#tags-filter { padding: 0 8px 8px; } +#postcustom #postcustomstuff .add-custom-field { + padding: 12px 8px 8px; +} + #side-sortables #postcustom #postcustomstuff .submit { margin: 0; padding: 0; @@ -1118,7 +1122,8 @@ form#tags-filter { width: auto; } -#postcustomstuff #newmetaleft a { +#postcustomstuff #newmetaleft a, +#postcustomstuff #newmeta-button { display: inline-block; margin: 0 8px 8px; text-decoration: none; diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index 791fe8253a..6024d8f607 100644 --- a/src/wp-admin/includes/template.php +++ b/src/wp-admin/includes/template.php @@ -724,16 +724,13 @@ function meta_form( $post = null ) { if ( $keys ) { natcasesort( $keys ); - $meta_key_input_id = 'metakeyselect'; - } else { - $meta_key_input_id = 'metakeyinput'; } ?>

- + @@ -753,19 +750,21 @@ function meta_form( $post = null ) { } ?> - - + + - + - - +
+ +
-
+
+
- - - -