Make WordPress Core

Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#24741 closed defect (bug) (fixed)

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

Reported by: yongbae's profile yongbae Owned by: nacin's profile 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 (3)

WordPress.wmv (2.4 MB) - added by yongbae 12 years ago.
24741.diff (4.3 KB) - added by aubreypwd 11 years ago.
Tests for commentReply before using onclick since commentReply isn't defined until the footer
24741.2.patch (1.6 KB) - added by peterwilsoncc 10 years ago.
Saving mechanism for comment-reply

Change History (17)

@yongbae
12 years ago

#1 @yongbae
12 years ago

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

http://core.trac.wordpress.org/attachment/ticket/24741/WordPress.wmv

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 12 years ago by yongbae (previous) (diff)

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


11 years ago

@aubreypwd
11 years ago

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

#3 @aubreypwd
11 years 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.

#4 @SergeyBiryukov
11 years ago

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

#5 @samuelsidler
11 years ago

  • Keywords commit added

#6 @nacin
11 years ago

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

#7 @nacin
11 years 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.

#8 follow-up: @aubreypwd
11 years 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?

Version 0, edited 11 years ago by aubreypwd (next)

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


11 years ago

#10 in reply to: ↑ 8 @azaozz
11 years 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.

#11 @SergeyBiryukov
11 years ago

  • Focuses administration added

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


11 years ago

@peterwilsoncc
10 years ago

Saving mechanism for comment-reply

#13 @peterwilsoncc
10 years ago

As a temporary measure is it worth adding a saving mechanism to the HTML header if comment-reply is enqueued but hasn't loaded?

It's hacky, yes, but it saves JavaScript explosions.

#14 @peterwilsoncc
10 years ago

Ignore me, looks like I misread this ticket. I'll hunt down/create one relating to the potential for JS breaking on the front end.

Note: See TracTickets for help on using tickets.