Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#27503 closed defect (bug) (fixed)

Heartbeat can cause a post slug to be generated while a title is being entered

Reported by: nacin's profile nacin Owned by: azaozz's profile azaozz
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.9
Component: Autosave Keywords: needs-patch
Focuses: Cc:

Description

It's possible to be in the middle of entering a post's title at the time heartbeat runs. When an autosave fires in this context, the callback attached to after-autosave.update-post-slug fires, resulting in a slug edit box.

Thus a post title of "Autosaving is a cool thing" ended up with a slug of "autos".

This should really only happen if the post title doesn't have the focus. I'm not sure what 3.8 behavior was but I believe autosave would only start to run when a field lost the focus.

Change History (3)

#1 follow-up: @azaozz
10 years ago

The behavior is the same in 3.8. This is somewhat mitigated by running the first autosave as soon as the title field is blurred.

Best way to fix this would be to not save the temporary permalink if the title field has focus. Then the permalink will be created (and the edit-slug-box shown) after the next autosave.

#2 in reply to: ↑ 1 @nacin
10 years ago

Replying to azaozz:

The behavior is the same in 3.8. This is somewhat mitigated by running the first autosave as soon as the title field is blurred.

Best way to fix this would be to not save the temporary permalink if the title field has focus. Then the permalink will be created (and the edit-slug-box shown) after the next autosave.

Works for me.

#3 @azaozz
10 years ago

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

In 27728:

Autosave: don't create the temporary permalink if the title field had focus (the user was typing a title) at the time of the last autosave. Fixes #27503

Note: See TracTickets for help on using tickets.