[wp-trac] [WordPress Trac] #46335: Custom HTML Issues
WordPress Trac
noreply at wordpress.org
Sun Feb 24 13:55:50 UTC 2019
#46335: Custom HTML Issues
--------------------------+-------------------------
Reporter: swagatam1975 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.1.1
Component: Widgets | Version: 5.1
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: javascript
--------------------------+-------------------------
Changes (by afercia):
* keywords: => needs-patch
* focuses: => javascript
* component: General => Widgets
* version: => 5.1
* milestone: Awaiting Review => 5.1.1
Comment:
@swagatam1975 thanks for your report and welcome to Trac.
I'm able to reproduce this in WordPress 5.1 and trunk. Works correctly in
5.0.
Seems to me the change in [44474] surfaced some pre-existing defect in the
logic. Specifically, now that the check for
`control.contentUpdateBypassed` works as intended, a `change` event is
triggered so the widgets is in a "dirty" state.
See
https://core.trac.wordpress.org/browser/trunk/src/js/_enqueues/wp/widgets
/custom-html.js?rev=44474&marks=115-120#L110
{{{
if ( ! control.contentUpdateBypassed ) {
syncInput = control.syncContainer.find( '.sync-input.content' );
control.fields.content.val( syncInput.val() ).trigger( 'change' );
}
}}}
Basically the widget is still flagged as "dirty" after it gets saved.
Therefore, the UI doesn't change to the saved state and navigating away
from the page triggers the JS alert for unsaved changes.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46335#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list