WordPress.org

Make WordPress Core

Opened 10 months ago

Closed 9 months ago

Last modified 5 months ago

#52046 closed defect (bug) (fixed)

The Distraction Free Writing setting on the old Edit Post screen may be reset after page reload

Reported by: azaozz Owned by: SergeyBiryukov
Milestone: 5.6.1 Priority: normal
Severity: normal Version: 5.6
Component: Editor Keywords: fixed-major
Focuses: Cc:

Description

Happens only in Firefox as reported at: https://wordpress.org/support/topic/scroll-doesnt-work-in-firefox/.

Clicking "Enable full-height editor and distraction-free functionality" in Screen Options on the old Edit Post screen would set "dfw mode" to on, but after couple of page reloads the checkbox appears checked but the setting is "off".

Attachments (1)

52046.diff (1.0 KB) - added by azaozz 10 months ago.

Download all attachments as: .zip

Change History (12)

#1 @azaozz
10 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.6.1

Setting tentatively to 5.6.1 pending a patch.

#2 @sabernhardt
10 months ago

Possibly related: #51995

#3 @azaozz
10 months ago

Think I (finally) got to the bottom of it. Looks like it is a timing issue (no surprise) of the 'tinymce-editor-init' custom jQuery event. Not sure why it only happens in Firefox but potentially can happen in any browser.

Problem is that event is triggered asynchronously/independently of the DOM loading, but several of the callbacks are attached on DOM ready. For some reason after the TinyMCE and jQuery updates the order there has changed a bit and now 'tinymce-editor-init' for the main editor on the old Edit Post screen may fire before DOM ready so several callbacks don't get executed. One of these callbacks is for making the toolbar "sticky" and setting/resetting "dfw mode". Patch coming up.

Last edited 10 months ago by azaozz (previous) (diff)

@azaozz
10 months ago

#4 @azaozz
10 months ago

  • Keywords has-patch needs-testing added; needs-patch removed

In 52046.diff: Trigger the tinymce-editor-init custom jQuery event on DOM ready. Otherwise TinyMCE may initialize earlier and handlers attached on DOM ready may not get triggered.

Please test!

#5 @azaozz
10 months ago

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

Changeset [49911].

Editor: Trigger the tinymce-editor-init custom jQuery event on DOM ready. Otherwise TinyMCE may initialize earlier and handlers attached on DOM ready may not get triggered. Fixes making the editor menu "sticky" and setting/resetting some screen options on the old Edit Post screen.

Fixes 52046, 51995.

#6 @azaozz
10 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopen for the 5.6 branch.

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


10 months ago

#8 @metalandcoffee
10 months ago

  • Keywords fixed-major added; has-patch needs-testing removed

#9 @SergeyBiryukov
9 months ago

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

In 49996:

Editor: Trigger the tinymce-editor-init custom jQuery event on DOM ready.

Otherwise TinyMCE may initialize earlier and handlers attached on DOM ready may not get triggered. Fixes making the editor menu "sticky" and setting/resetting some screen options on the old Edit Post screen.

Props azaozz, majhajob, sabernhardt.
Merges [49911] to the 5.6 branch.
Fixes #52046, #51995.

#10 @herrvigg
8 months ago

I'm recopying here what I wrote in other tickets. Not sure but this could explain the problem, asynchronous firing with jQuery3: https://github.com/jquery/jquery/issues/3194

With jQuery3, ready handlers fire asynchronously and may be fired after load... there's no guarantee so that can explain some "random" behaviors.

Long story short, the load trigger should never be set in the ready callback but outside. Ideally it should even be avoided when using ready.

This ticket was mentioned in Slack in #core-test by azaozz. View the logs.


5 months ago

Note: See TracTickets for help on using tickets.