WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 7 months ago

Last modified 7 months ago

#24423 closed enhancement (fixed)

After updating the post, only focus post title field if it's empty

Reported by: klihelp Owned by: nacin
Milestone: 3.7 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: has-patch 3.7-early
Focuses: ui Cc:

Description

The post formats looks very nice.

One small thing could be more user friendly.
Currently when you change between the post formats then the Title field becomes focused and the title text will be selected.

Happened a lot with me that when I wanted to just use Space to scroll down the page, accidentally deleted the title text. Pressing any key is deleting the selected text in the title field.
Happened a lot with me that when I wanted to just use Space to scroll down the page, but accidentally deleted the title text.

It would be better if the title field getting the focus only if it's empty.

http://qikr.co/files/pics/w/wpadminiss29707.jpg

I commented my feedback for Post Format UI title input box, but didn't got any response for that, so I though I open this new ticket.

http://core.trac.wordpress.org/ticket/24046#comment:61

Attachments (2)

24423.patch (613 bytes) - added by scruffian 10 months ago.
Only focus the post title when it is empty
24423.2.patch (639 bytes) - added by scruffian 10 months ago.
Only focus the post title when it is empty

Download all attachments as: .zip

Change History (19)

comment:1 klihelp11 months ago

  • Summary changed from Blur post title field when title isn't empty to Focus on post title field when title is empty

comment:2 SergeyBiryukov11 months ago

  • Keywords reporter-feedback removed
  • Milestone changed from Awaiting Review to 3.6

Looks like the latest patches on #24011 resolve this for Status and Aside formats: ticket:24011:45.

comment:3 johnbillion10 months ago

  • Milestone 3.6 deleted
  • Resolution set to invalid
  • Status changed from new to closed

comment:4 klihelp10 months ago

Hi @john, did you closed the correct ticket?

This behaviour is there on the edit post/page ..
When you update the post, the title field get the focus, which gets deleted pressing any key ... except the tab. The most used key is the spacebar and this just deletes the title.
Should be this normal?

comment:5 johnbillion10 months ago

  • Component changed from Post Formats to Administration

Ah now that is interesting. The title field gets focused when you update the post, but not when you first arrive on the edit screen for the post.

I agree, the title field shouldn't be focused when it's not empty. This is not a Post Formats issue, but a general issue.

comment:6 johnbillion10 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:7 helen10 months ago

  • Milestone set to Awaiting Review

comment:8 SergeyBiryukov10 months ago

  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 2.5

Not a regression, happens all the way back to 2.5.

comment:9 SergeyBiryukov10 months ago

  • Summary changed from Focus on post title field when title is empty to After updating the post, only focus post title field if it's empty

scruffian10 months ago

Only focus the post title when it is empty

scruffian10 months ago

Only focus the post title when it is empty

comment:10 scruffian10 months ago

I added a patch for this. It made sense to take out the PHP if statement altogether and just look at the title field, so we always, and only, focus when the field is blank.

comment:11 SergeyBiryukov10 months ago

  • Keywords has-patch 3.7-early added; needs-patch removed

comment:12 wonderboymusic9 months ago

  • Milestone changed from Future Release to 3.7

these are all marked 3.7-early

comment:13 SergeyBiryukov8 months ago

  • Keywords ui-focus added

comment:14 helen7 months ago

Wouldn't just removing the the second part of the PHP conditional work?

comment:15 nacin7 months ago

I suspect that [1236/trunk/wp-admin/edit-form-advanced.php] was supposed to be if ( ! isset( $_GET['message'] ) || 2 > $_GET['message'] ). That way if message was not set at all, the title field gets the focus. That logic issue way back when resulted in [6059], which otherwise wasn't needed for new posts.

The way the code is written is it also receives the focus for any message less than 2. That's because in [1197], messages 2 and 3 were added, and they had to do with custom fields, not saving the post. It no longer makes sense.

Yes, it should go.

comment:16 nacin7 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from reopened to closed

In 25459:

Only focus the title field when it is empty. Remove ancient code that provided for an alternate condition.

props scruffian for initial patches.
props helen.
fixes #24423.

comment:17 SergeyBiryukov7 months ago

In 25461:

Check if the post type supports title. see #24423.

Note: See TracTickets for help on using tickets.