WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#33059 closed defect (bug) (fixed)

Publish box timestamp form elements initial focus

Reported by: afercia Owned by: iseulde
Milestone: 4.3 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: ui, javascript Cc:
PR Number:

Description

In the Post Publish box, when opening the timestamp expandable div, focus is moved to the "Month" select. This is correct when the language set is English.
Turns out translators can swap the fields to adapt them to their locale date format, for example see the Italian publish box in the screenshot below:

https://cldup.com/ywjwYkxyEN.png

I guess Italian is not the only case and we shouldn't assume the Month select will always be the first form element.

Attachments (2)

33059.patch (510 bytes) - added by afercia 4 years ago.
33059.2.patch (587 bytes) - added by iseulde 4 years ago.

Download all attachments as: .zip

Change History (11)

@afercia
4 years ago

#1 @afercia
4 years ago

  • Keywords has-patch added

Proposed patch moves focus to the first, visible, input or select element.

#2 @afercia
4 years ago

Noticed that sometimes screen readers have issues when focus is moved to elements that are still not fully visible. Focus should always be moved when the animation is complete. Will open a new ticket for this.

Last edited 4 years ago by afercia (previous) (diff)

#3 follow-up: @iseulde
4 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Version 4.2 deleted

Why input:visible?

#4 in reply to: ↑ 3 @afercia
4 years ago

Replying to iseulde:

Why input:visible?

There are some hidden inputs in the timestamp div, just wanted to be sure to exclude them. And yes they come after so :visible maybe is unnecessary but who knows maybe some future markup change could place some hidden inputs before. On the other hand, targeting the inner .timestamp-wrap would mean getting one more element. Oh well maybe I'm overthinking, feel free to change it and keep it simple if you think that would be better :)

@iseulde
4 years ago

#5 @iseulde
4 years ago

@afercia Does this look good?

This ticket was mentioned in Slack in #core by iseulde. View the logs.


4 years ago

This ticket was mentioned in Slack in #core by afercia. View the logs.


4 years ago

#8 @iseulde
4 years ago

  • Owner set to iseulde
  • Resolution set to fixed
  • Status changed from new to closed

In 33349:

Publish box: focus first date field on edit

The order of the fields may change depending on the translation.

Props afercia.
Fixes #33059.

#9 @iseulde
4 years ago

  • Milestone changed from Future Release to 4.3
Note: See TracTickets for help on using tickets.