[wp-trac] [WordPress Trac] #36462: Updating or publishing a (custom) post that hasn't loaded completely closes comments
WordPress Trac
noreply at wordpress.org
Sun May 22 16:43:10 UTC 2016
#36462: Updating or publishing a (custom) post that hasn't loaded completely closes
comments
-------------------------------+-----------------------------
Reporter: SeBsZ | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Posts, Post Types | Version: 4.4.2
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: administration
-------------------------------+-----------------------------
Changes (by boonebgorges):
* keywords: => needs-patch
* focuses: => administration
* milestone: Awaiting Review => Future Release
Comment:
> Any updates? It's very easy to reproduce.
It does look like there's a problem. Do you have any ideas on how to
resolve? The problem is that `comment_status` (and some other fields) are
passed as a checkbox. So when we inspect the POST payload, and we don't
see the `comment_status` value, it's not possible to interpret it: has
`comment_status` been disabled, or did the checkbox not load into the DOM?
Moving the Discussion box to the top of the screen seems like a potential
workaround, but it just punts the problem - there could be another
checkbox further down the page that exhibits the same issue.
One answer is not to use checkboxes at all. This does not seem viable to
me, since checkboxes are sometimes the best UX for a given setting.
Another is to output a hidden field that contains the *actual* value of
`comment_status`, and to update that field via JS when the checkbox is
toggled. Then, we look at this hidden field in the POST handler. The
downside of this is that it doesn't degrade well when JavaScript is
disabled. Perhaps *another* hidden field could be added via JS when the
form is rendered - something like `<input type="hidden" name="do-checkbox-
compat" value="1">` (obviously, a better name would be nice) - and then
the POST handler would only look for the value of the hidden fields if
`do-checkbox-compat` were present. I think this strategy has potential,
but it needs prototyping and testing around the edges - slow-loading
pages, JS disabled, JS broken by a plugin, etc - to move forward.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36462#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list