Make WordPress Core

Opened 11 years ago

Closed 10 years ago

Last modified 3 years ago

#24423 closed enhancement (fixed)

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

Reported by: klihelp's profile klihelp Owned by: nacin's profile 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 11 years ago.
Only focus the post title when it is empty
24423.2.patch (639 bytes) - added by scruffian 11 years ago.
Only focus the post title when it is empty

Download all attachments as: .zip

Change History (19)

#1 @klihelp
11 years ago

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

#2 @SergeyBiryukov
11 years 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.

#3 @johnbillion
11 years ago

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

#4 @klihelp
11 years 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?

#5 @johnbillion
11 years 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.

#6 @johnbillion
11 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

#7 @helen
11 years ago

  • Milestone set to Awaiting Review

#8 @SergeyBiryukov
11 years 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.

#9 @SergeyBiryukov
11 years 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

@scruffian
11 years ago

Only focus the post title when it is empty

@scruffian
11 years ago

Only focus the post title when it is empty

#10 @scruffian
11 years 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.

#11 @SergeyBiryukov
11 years ago

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

#12 @wonderboymusic
11 years ago

  • Milestone changed from Future Release to 3.7

these are all marked 3.7-early

#13 @SergeyBiryukov
10 years ago

  • Keywords ui-focus added

#14 @helen
10 years ago

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

#15 @nacin
10 years 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.

#16 @nacin
10 years 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.

#17 @SergeyBiryukov
10 years ago

In 25461:

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

Note: See TracTickets for help on using tickets.