Make WordPress Core

Opened 9 months ago

Closed 3 weeks ago

Last modified 3 weeks ago

#24741 closed defect (bug) (fixed)

"Quick Edit" button at "Comments" page doesn't work in slow connection

Reported by: yongbae Owned by: nacin
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.5.1
Component: Comments Keywords: has-patch commit
Focuses: administration Cc:

Description (last modified by SergeyBiryukov)

I found that "Quick Edit" button at "Comments" page does not correctly work when necessary JavaScript files are not yet fully loaded. I observe this problem in WordPress version 3.5.1.

I guess this problem happens when a user makes a clicks on “Quick Edit” button too soon before some external JavaScript for the feature get loaded. For this reason, It seems this bug would be more problematic when network connection is slow.

Here's the use case scenario by which you can reproduce the error:

  1. get log in WordPress site.
  1. click “Comments” button in left side menu in “Dashboard” page.
  1. click “Quick Edit” button. The error may occur at this moment -- even though you clicked, the input form may not show up, and my Firefox browser shows an uncaught exception:

Attachments (2)

WordPress.wmv (2.4 MB) - added by yongbae 6 months ago.
24741.diff (4.3 KB) - added by aubreypwd 7 weeks ago.
Tests for commentReply before using onclick since commentReply isn't defined until the footer

Change History (13)

yongbae6 months ago

comment:1 yongbae6 months ago

For your better understanding of the buggy scenario,
I just added a video that shows an actual error execution.


Loading of "Comments" page starts at 00:15. At 00:17, I clicked "Quick Edit" button and the error message "ReferenceError: commentReply is not defined" appears in Firefox console.

Let me know if you have a probelm of reproducing the error. Thank you.

Last edited 6 months ago by yongbae (previous) (diff)

comment:2 ircbot7 weeks ago

This ticket was mentioned in IRC in #wordpress-dev by aubreypwd. View the logs.

aubreypwd7 weeks ago

Tests for commentReply before using onclick since commentReply isn't defined until the footer

comment:3 aubreypwd7 weeks ago

  • Keywords has-patch added

edit-comments.js indeed is not loaded until the footer, so onclick="commentReply.open" would not work beforehand because commentReply is not yet defined. I've attached a patch that tests that commentsReply is an object before it's accessed. Successfully keeps the error from posting, which could cause problems maybe in some situations.

comment:4 SergeyBiryukov7 weeks ago

  • Description modified (diff)
  • Milestone changed from Awaiting Review to 3.9

comment:5 samuelsidler3 weeks ago

  • Keywords commit added

comment:6 nacin3 weeks ago

The proper thing to do here is to make this be unobtrusive JavaScript. Committing this will make me die a little inside.

comment:7 nacin3 weeks ago

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

In 27747:

Avoid JS errors before the commentReply script loads. Let's make this unobtrusive soon.

props aubreypwd.
fixes #24741.

comment:8 follow-up: aubreypwd3 weeks ago

@nacin So, do we want to ad id='s to these and apply via JQuery? Would that be the best route? And where would to JS go in core to make this unobtrusive?

Related: #27533

Last edited 3 weeks ago by aubreypwd (previous) (diff)

comment:9 ircbot3 weeks ago

This ticket was mentioned in IRC in #wordpress-dev by aubreypwd. View the logs.

comment:10 in reply to: ↑ 8 azaozz3 weeks ago

Replying to aubreypwd:

You don't need HTML IDs there. So many different ways to make this particular code better :)

The least changes one would be to add data-wp-* attributes and have one $( document ).on( 'click.comment-row-actions', function()... to catch all clicks on these links.

comment:11 SergeyBiryukov3 weeks ago

  • Focuses administration added
Note: See TracTickets for help on using tickets.