Opened 15 months ago
Closed 15 months ago
#59689 closed defect (bug) (fixed)
Function listening to AJAX actions to set `Prefers reduced motion` is affecting whole WP Admin in 6.4 RC
Reported by: | bplv | Owned by: | joedolson |
---|---|---|---|
Milestone: | 6.4 | Priority: | normal |
Severity: | normal | Version: | 6.4 |
Component: | Plugins | Keywords: | has-patch needs-testing has-testing-info dev-reviewed |
Focuses: | javascript | Cc: |
Description
- The newly added jQuery function on 6.4 RC listens to all completed Ajax requests. https://github.com/WordPress/wordpress-develop/commit/ef54f4e57fc936ca3f505cb1f00b54a74ac75114#diff-b9e9194f24d2a3548ae0b16b6bde5e0c7756a2b7668bed4d1040093e00550bf6R2201
- The function expects string but if the data is an object it throws an error for other requests as well. https://github.com/WordPress/wordpress-develop/commit/ef54f4e57fc936ca3f505cb1f00b54a74ac75114#diff-b9e9194f24d2a3548ae0b16b6bde5e0c7756a2b7668bed4d1040093e00550bf6R2203
Attachments (6)
Change History (32)
This ticket was mentioned in PR #5536 on WordPress/wordpress-develop by @bplv.
15 months ago
#1
- Keywords has-patch added
#2
@
15 months ago
- Milestone changed from Awaiting Review to 6.4
- Owner set to joedolson
- Status changed from new to accepted
Thanks, @bplv! This seems like a reasonable fix to an issue introduced in 6.4; will review.
#5
@
15 months ago
Hey @joedolson, Are you available to review the patch(es) ahead of 6.4 RC2 (which is tomorrow, Oct 24th)?
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
15 months ago
#8
@
15 months ago
@bplv thanks for your patch. I checked your last patch 59689.4.diff
and it looks good to me because at first, you checked the current page plugin-install
by using window.pagenow !== 'plugin-install'
which will prevent to execute any other pages Ajax request. Then you also check is settings data string by using typeof settings.data === "string"
which will exclude all other types of settings data.
Just to keep consistency, I think you can use 'string'
instead of "string"
because the single quote is a more strict sting and everywhere uses a single quote of this file.
#10
@
15 months ago
- Keywords needs-testing added
Patch: either 59689.4.diff or PR 5536 - both are the same.
The patch(es) need test reports.
#12
in reply to:
↑ 11
@
15 months ago
- Keywords changes-requested removed
Replying to bplv:
@rudlinkon Updated the patch.
It now looks good to me, waiting for the test report.
This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.
15 months ago
#14
@
15 months ago
Thanks for Patch @bplv
59689.5.diff This patch looks good for me.
This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.
15 months ago
#16
follow-up:
↓ 19
@
15 months ago
Testing instructions:
1) For easier observation, add something obvious like console.log( 'Caught AJAX event' );
after the ajaxComplete
in the listener.
2) Execute an AJAX driven action in the admin, e.g. approving or unapproving a comment in the Dashboard activity widget.
3) Observe the console log printing the caught event.
This demonstrates that the ajaxComplete
listener is catching all ajax actions.
However, I'm not sure that the provided PR solves this; ajaxComplete
still executes, it just exits earlier. If you implemented the same instructions above, the test would still fail.
Per my comment in the PR, I think that the check should happen as a condition for the listener to run.
#18
@
15 months ago
- Keywords has-testing-info added
Test results with 59689.6.diff
- Before patch: console log statement appears when performing irrelevant AJAX actions.
- After patch: console log statement no longer appears, plugin animations are still stopped as expected on plugin install screen.
#19
in reply to:
↑ 16
@
15 months ago
Replying to joedolson:
Testing instructions:
1) For easier observation, add something obvious like
console.log( 'Caught AJAX event' );
after theajaxComplete
in the listener.
2) Execute an AJAX driven action in the admin, e.g. approving or unapproving a comment in the Dashboard activity widget.
3) Observe the console log printing the caught event.
This demonstrates that the
ajaxComplete
listener is catching all ajax actions.
However, I'm not sure that the provided PR solves this;
ajaxComplete
still executes, it just exits earlier. If you implemented the same instructions above, the test would still fail.
Per my comment in the PR, I think that the check should happen as a condition for the listener to run.
Yes, you are right. It is more logical to check the current page before starting the listener.
#21
@
15 months ago
FYI, 59689.6.diff included an unrelated change by mistake; but it's not relevant to this test at all, so doesn't impact @jorbin's comments. Updating patch, then committing to trunk.
#23
@
15 months ago
- Keywords dev-feedback added; commit removed
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backport to 6.4. Adding dev-feedback
for second committer sign off.
#24
@
15 months ago
- Keywords dev-reviewed added; dev-feedback removed
[57022] is good for a backport to 6.4.
Trac ticket: https://core.trac.wordpress.org/ticket/59689