WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#27251 closed defect (bug) (fixed)

In Admin, Firefox is caching the editor contents. Showing wrong content after refresh, if post was saved elsewhere.

Reported by: xsonic Owned by: azaozz
Milestone: 3.9 Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: administration Cc:

Description

Steps to recreate:

Open two tabs (in Firefox), editing the same post.
Edit and save post in one tab, refresh the other.
Other tab will show old contents, because Firefox' implementation of autocomplete. Can't judge if this is a bug in FF or in WP.

Adding

autocomplete="off"

to the textarea solves this issue.

Attachments (1)

27251.patch (2.2 KB) - added by azaozz 6 years ago.

Download all attachments as: .zip

Change History (7)

#1 @azaozz
6 years ago

Thanks @xsonic for the report and the suggested patch. Have seen this in other cases, most commonly when clicking the back button.

Then the problem is that the last version of the content in the textarea doesn't include the <p> tags. Happens because when autosave runs, the content of the textarea is updated and ran through pre_wpautop(). When the browser loads the page from cache or fills the textarea with autocomplete and TinyMCE is initialized, all paragraphs are merged.

#2 @azaozz
6 years ago

  • Milestone changed from Awaiting Review to 3.9

@azaozz
6 years ago

#3 @azaozz
6 years ago

In 27251.patch: add autocomplete="off" to the editor textarea and make it configurable from the editor settings.

This fixes the above problems but stops recovering the textarea content when the Text editor is used and the page is reloaded. Still thinking we should add this to avoid problems with autop and inconsistencies when the Visual editor is used.

#4 @xsonic
6 years ago

Glad this got reviewed so quickly.
I use a frontend editor on a page, and users might get confused by this issue:
If they edit the page on the frontend, save it, and reload it on the backend, they don't see the changes.

With more and more frontend editors popping up, it's good to have this option.

#5 @azaozz
6 years ago

Looking at this more: when only the Text editor is used, having autocomplete preserves the user input when reloading the page or using the browser's Go Back/Go Forward buttons.

The best compromise would be to add autocomplete="off" only when TinyMCE is used, as the textarea value will always be without <p> tags when filled by autocomplete (when the editor uses wpautop).

#6 @azaozz
6 years ago

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

In 27366:

Editor: when TinyMCE is used, add autocomplete="off" to the textarea to prevent problems with missing <p> tags when the user reloads the page or uses Go Back/Go Forward buttons, and when editing the same post from two different windows. The autocomplete can be removed with the the_editor filter. Part props xsonic, fixes #27251.

Note: See TracTickets for help on using tickets.