Make WordPress Core

Opened 12 years ago

Last modified 9 days ago

#15631 reopened enhancement

Custom fields auto-focus

Reported by: jane's profile jane Owned by: joedolson's profile joedolson
Milestone: 6.3 Priority: normal
Severity: normal Version: 3.1
Component: Editor Keywords: has-patch has-ux-feedback needs-testing
Focuses: ui, accessibility Cc:

Description

When you are on the post editor (page editor, whatever), if you want to create a new custom field and click on Create New, it should auto-focus on the text input field that appears.

Attachments (5)

15631.diff (1.1 KB) - added by batmoo 12 years ago.
15631-datalist.diff (1.9 KB) - added by sabernhardt 12 months ago.
datalist concept
15631.2.diff (2.5 KB) - added by sabernhardt 12 months ago.
updating focus and labels in current interface
15631.3.diff (2.5 KB) - added by joedolson 12 days ago.
Refreshed patch
15631.4.diff (3.2 KB) - added by joedolson 12 days ago.
Use button appearance & move add custom field out of table

Download all attachments as: .zip

Change History (22)

@batmoo
12 years ago

#1 @batmoo
12 years ago

  • Cc batmoo@… added
  • Keywords has-patch added

Moved inline javascript to post.dev.js and set the field to auto-focus.

Should the input be reverted back to the select once a new custom field is added? It just seems weird (possibly confusing) because of the "cancel" link.

#2 @sabreuse
10 years ago

  • Component changed from UI to Editor
  • Keywords ui-focus added

#3 @chriscct7
8 years ago

  • Keywords needs-refresh ux-feedback added

This ticket was mentioned in Slack in #design by karmatosed. View the logs.


6 years ago

#5 @karmatosed
6 years ago

  • Keywords has-ux-feedback added; ux-feedback removed

I agree that the input should revert once custom field is added, without cancel link. If this is still an issue it will need a patch check due to age.

I am tackling this during weekly ux-feedback triage.

#6 @sabernhardt
20 months ago

  • Focuses accessibility added

Changing the focus behavior might help, yet I'm more concerned about the lack of a label on the meta key input field. So even if you think to use Shift + Tab to go back to the meta key input, a screen reader cannot say what you are editing.

Last edited 20 months ago by sabernhardt (previous) (diff)

#7 @franrosa
12 months ago

Maybe I am missing something here, but would not adding a text input on the list of options to either search existing fields or writing the name of a new one to add eliminate the need to have that dual UI with that confusing New/Cancel pattern?

It would be similar to the existing UI for links, with the added option to 'Create new' when no result is found. (Quick mockup for clarity: https://drive.google.com/file/d/1VvPlU_j5aXDTN445CkeMmGNpBk2dVko8/view?usp=sharing)

This ticket was mentioned in Slack in #accessibility by franrosa. View the logs.


12 months ago

@sabernhardt
12 months ago

datalist concept

@sabernhardt
12 months ago

updating focus and labels in current interface

#9 @sabernhardt
12 months ago

  • Keywords needs-refresh removed

This is a feature of the classic editor that the block editor adopted. There was some trouble creating a custom fields UI element there in the months before WordPress 5.0, which could be easier now. Discussion about an element like the block editor's link autocomplete would fit better in the Gutenberg repo.

Yet your suggestion led me to think about the native datalist element. Firefox still has a bug with the dropdown, but the element could be worth considering.

15631-datalist.diff

  • Replaces select with a datalist of the same options
  • Uses the "Name" table header as the label for the input field
  • Removes the "Enter New"/"Cancel" toggle link
  • Would need CSS editing for the dropdown triangle position

I also created 15631.2.diff to follow prior feedback:

  • Ensures that the "Name" table header as the label for the select element
  • Creates a "New custom field name" ARIA label for the input field
  • Converts the toggle link to a button
  • Moves focus to the input after clicking "Enter New", and to the select after "Cancel" or "Add Custom Field"
  • Keeps the JS inline (I would have added it to post.js, but the block editor apparently does not load it)
Last edited 6 months ago by sabernhardt (previous) (diff)

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


5 months ago

#11 @joedolson
3 months ago

  • Milestone changed from Future Release to 6.3
  • Owner set to joedolson
  • Status changed from new to accepted

This ticket was mentioned in Slack in #accessibility by ryokuhi. View the logs.


3 months ago

#13 @ryokuhi
3 months ago

  • Keywords needs-testing added

We reviewed this ticket today during the Accessibility Team's bug scrub.
The ticket needs testing to check if patch 15631.2.diff still applies clearly or if a refresh is needed.

#14 @annashopina
8 weeks ago

  • Resolution set to invalid
  • Status changed from accepted to closed

Test Report
This report validates that the issue is still reproduced.
Patch tested: https://core.trac.wordpress.org/ticket/15631
Environment
OS: macOS 13.1
Web Server: Nginx
PHP: 8.0
WordPress: 6.3
Browser: Chrome 111.0.5563.146
Active Plugins:
Classic Editor
Actual Results
The issue was not resolved with a patch.
Additional Notes
Steps to reproduce:
Install and activate Classic Editor
Open any post/page
Open 'Screen options
Enable 'Custom fields'
Add custom field
Observe where is the focus
Add Inline:
Actual result: It's not auto-focused on the text input field that appears.

Expected result: It should auto-focus on the text input field that appears.

#15 @annashopina
8 weeks ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

#16 @joedolson
12 days ago

Note: the test by @annashopina looks like it was testing whether focus was moved when using the 'Add Custom Field' button, but this ticket is about moving focus to the text field when 'Enter New' is chosen to define a new custom field name. So that test isn't valid.

I just tested, and the patch tests fine. I'm uploading two patches; 15631.3.diff is a refresh of the previous patch, 15631.4.diff changes the 'Enter new' button to use the button-small appearance (matching the delete/update buttons on existing fields & avoiding the semantic confusion of something that is a button but looks like a link) and moves the 'Add Custom Field' button out of the table, because the semantics don't make sense.

@joedolson
12 days ago

Refreshed patch

@joedolson
12 days ago

Use button appearance & move add custom field out of table

This ticket was mentioned in Slack in #accessibility by joesimpsonjr. View the logs.


9 days ago

Note: See TracTickets for help on using tickets.