Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#32527 closed defect (bug) (fixed)

"Press This" TypeError on drop images

Reported by: sebastiantiede's profile sebastiantiede Owned by: azaozz's profile azaozz
Milestone: 4.3 Priority: normal
Severity: normal Version: 4.2
Component: Media Keywords: has-patch
Focuses: javascript, administration Cc:


"Press This" bookmarklet — Clean WP 4.2.2
An error occurred on image drop after upload while insertion to the editor via media popup (see the error below).

no error:

  • I drop the image -> unselect and select the dropped image -> insert
  • Open media popup -> select any image -> insert
TypeError: document.getElementById(...) is null
Line 127

Attachments (3) (741.2 KB) - added by sebastiantiede 8 years ago.
Screencast Chrome Press This Bug
32527.patch (557 bytes) - added by rommelxcastro 8 years ago.
325271.1.patch (548 bytes) - added by rommelxcastro 8 years ago.

Download all attachments as: .zip

Change History (18)

#1 @johnbillion
8 years ago

  • Keywords needs-patch added
  • Version changed from 4.2.2 to 4.2

#2 @rommelxcastro
8 years ago

i tried to reproduce this on version 4.3-alpha-32828 and was unable to reproduce it

#3 @azaozz
8 years ago

  • Keywords reporter-feedback added

Can't reproduce either. Could you clear browser cache (always a good thing while debugging), then enable SCRIPT_DEBUG to see exactly where that error comes from.

#4 @sebastiantiede
8 years ago

After clearing browser cache and enabling


the error is:

TypeError: document.getElementById(...) is null
Line 793

#5 @rommelxcastro
8 years ago

  • Keywords reporter-feedback removed

thank you @sebastiantiede, i'll start working on a patch for this

Last edited 8 years ago by rommelxcastro (previous) (diff)

#6 @rommelxcastro
8 years ago

  • Keywords reporter-feedback added

hey @sebastiantiede, i'm still unable to reproduce this, tested on macosx with chrome and firefox
4.3-alpha-32828 and 4.2.2

#7 @azaozz
8 years ago

This implies that the wpActiveEditor JS "global" is not set. For PT that should always be set to pressthis (the editor id).

It may have something to do with the "Add Media" button (lower/left corner), as it has nested span element that actually receives the clicks. However haven't been able to reproduce in any current browser, tested in Chrome, Firefox and IE11.

8 years ago

Screencast Chrome Press This Bug

#8 @sebastiantiede
8 years ago

The error occurs in Firefox 38.0.5 and Chrome 43.0.2357.124 on MacOSX.
I attached a short Screencast with the move that triggers the error.

#9 @rommelxcastro
8 years ago

  • Keywords has-patch needs-testing 2nd-opinion added; needs-patch reporter-feedback removed

hey guys, here's a patch for this, tested on other editors and seems like i didn't broke anything but if someone else can help testing that would be great! thanks

8 years ago

8 years ago


#10 @azaozz
8 years ago

Nice catch! When opening the modal, that id has to be either empty or wpActiveEditor.

Was finally able to reproduce the error too, have to open PT and drop a file for uploading straight away, without clicking anywhere, etc.

#11 @azaozz
8 years ago

  • Component changed from Press This to Media
  • Keywords needs-testing 2nd-opinion removed
  • Milestone changed from Awaiting Review to 4.3

#12 @azaozz
8 years ago

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

In 32894:

Fix error when dropping files for uploading on the editor before the media modal is initialized.
Props rommelxcastro, sebastiantiede. Fixes #32527.

#13 @sebastiantiede
8 years ago

great, thanks.

#14 @rommelxcastro
8 years ago

#31547 was marked as a duplicate.

#15 @iseulde
8 years ago

#29733 was marked as a duplicate.

Note: See TracTickets for help on using tickets.