Make WordPress Core

Opened 10 years ago

Closed 9 years ago

Last modified 9 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:

Description

"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
http://l/_playgrounds/wordpress/wp-admin/load-scripts.php?c=1&load%5B%5D=hoverIntent,common,underscore,shortcode,backbone,wp-util,wp-backbone,media-models,wp-plupload,jquery-ui-core,jquery-ui-widget,jq&load%5B%5D=uery-ui-mouse,jquery-ui-sortable,mediaelement,wp-mediaelement,media-views,media-editor,media-audiovideo,wp-playlist,mce-view,img&load%5B%5D=areaselect,image-edit,suggest,tags-box,press-this,editor,word-count,wplink&ver=4.2.2
Line 127

Attachments (3)

wp_bug_4.2.2_press.mov.gif (741.2 KB) - added by sebastiantiede 9 years ago.
Screencast Chrome Press This Bug
32527.patch (557 bytes) - added by rommelxcastro 9 years ago.
325271.1.patch (548 bytes) - added by rommelxcastro 9 years ago.
formatting

Download all attachments as: .zip

Change History (18)

#1 @johnbillion
10 years ago

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

#2 @rommelxcastro
9 years ago

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

#3 @azaozz
9 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
9 years ago

After clearing browser cache and enabling

SCRIPT_DEBUG

the error is:

TypeError: document.getElementById(...) is null
/wp-includes/js/media-editor.js?ver=4.2.2
Line 793

#5 @rommelxcastro
9 years ago

  • Keywords reporter-feedback removed

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

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

#6 @rommelxcastro
9 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
9 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.

@sebastiantiede
9 years ago

Screencast Chrome Press This Bug

#8 @sebastiantiede
9 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
9 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

@rommelxcastro
9 years ago

@rommelxcastro
9 years ago

formatting

#10 @azaozz
9 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
9 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
9 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
9 years ago

great, thanks.

#14 @rommelxcastro
9 years ago

#31547 was marked as a duplicate.

#15 @iseulde
9 years ago

#29733 was marked as a duplicate.

Note: See TracTickets for help on using tickets.