Make WordPress Core

Opened 18 months ago

Last modified 18 months ago

#39475 new defect (bug)

Customize doesn't consider the hash in the URL after change

Reported by: edpittol Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.4
Component: Customize Keywords: needs-patch
Focuses: javascript Cc:


When I open a page that has a hash in the URL, in the Customize, the behavior wasn't the expected. At least for me. The preview Iframe is loaded in the first time with the hash. But after a setting update, using the refresh transport, the hash disappear.

Customizer URL /wp-admin/customize.php?url=http%3A%2F%2Flocalhost%3A8080%2F%23hide-entry-screen

First preview Iframe href /?customize_changeset_uuid=e041a773-41df-4fcb-a800-01fa3249233d&customize_theme=senplo&customize_messenger_channel=preview-0#hide-entry-screen

Second preview Iframe href (after a change) /?customize_changeset_uuid=e041a773-41df-4fcb-a800-01fa3249233d&customize_theme=senplo&customize_messenger_channel=preview-1

I debugged the customize JS scripts and saw that in the line 796 of the wp-includes/js/customize-preview.js file is set the frame URL. It come from api.settings.url.self value. I cannot identify where this value is the.

In a quick test, I concatenated the hash with the URL and the second Iframe was loaded with it.

Change History (2)

#1 @westonruter
18 months ago

  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 4.7 to 3.4

@edpittol yes, improvements are needed to how page anchors aka URL hash fragments are handled in the customizer preview. Another case which isn't handled as expected right now is a link from one page to another with a fragment supplied. This won't scroll to the page anchor as expected.

I think this is a longstanding behavior with the customizer preview behavior and isn't anything new.

#2 @westonruter
18 months ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.