WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#3927 closed defect (bug) (invalid)

Dragging and dropping uploaded image can retain the onclick="return false;" attribute

Reported by: johnbillion Owned by:
Milestone: Priority: low
Severity: minor Version: 2.1.2
Component: Administration Keywords: needs-patch
Focuses: Cc:

Description

Steps to reproduce:

  1. Open up the New Post writing screen and make sure you're using the visual editor.
  2. Upload an image using the inbuilt upload box, or click on Browse All to see your existing uploads.
  3. If you've clicked Browse All then single click on an image (must be an image) to open up the further options.
  4. Drag and drop the image from there onto your post editing box.
  5. Now switch to the 'code' tab or publish the post and then view it
  6. Note that the hyperlink retains the onclick="return false;" attribute which is used internally in the upload box.

Tested in Firefox 2 on Windows XP. Doesn't affect IE or Opera as you can't drag and drop with those anyway.

This means if the hyperlink is clicked on the published post, nothing happens as the return false kicks in.

Affects 2.1 release and 2.2 bleeding as of r4999.

Change History (10)

comment:1 foolswisdom7 years ago

  • Milestone set to 2.2

comment:2 follow-up: rob1n7 years ago

  • Keywords dev-feedback 2nd-opinion added; uploading needs-patch removed
  • Owner changed from anonymous to andy
  • Priority changed from normal to low
  • Version changed from 2.1 to 2.1.2

Reproduced.

I believe this is a Firefox/IE issue (and it's not really an issue). The drag-n-dropping isn't done by JS by WordPress -- it's a built in function to drag any link to any text area/input box.

I don't know how we can fix this. Maybe add a filter to clean those links out once the contents of the post contents area has changed? Like I said, this is going to be tricky.

Assigning to andy, as he's the in-house JS guru ;).

Also, I don't know if this is necessary to be fixed, as I never even thought of dragging and dropping before I read this ticket. The controls provided do the job fine...

comment:3 in reply to: ↑ 2 ; follow-up: foolswisdom7 years ago

Replying to rob1n:

Also, I don't know if this is necessary to be fixed, as I never even thought of dragging and dropping before I read this ticket. The controls provided do the job fine...

I see it all the time on WordPress.com , it is an intuitive action.

comment:4 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.3

comment:5 rob1n7 years ago

  • Keywords needs-patch added; dev-feedback 2nd-opinion removed

comment:6 johnbillion7 years ago

The solution here would be to apply the onclick="return false" action to the link dynamically, therefore it wouldn't show up inside the a tag when you dragged it into the post editing textarea. The upload JS is crazy though and I can't figure it out myself.

comment:7 andy7 years ago

  • Owner andy deleted

History: When uploading was first added to the edit form it was supposed to work by drag-and-drop. We canned that when it became evident that IE's drag-and-drop implementation does not provide complete information to the target element. Therefore we do not support drag-and-drop and we added "send to editor" functions instead.

Anybody is welcome to work out a patch to make this work better for the adventurous drag/dropper.

comment:8 andy7 years ago

foolswisdom: nobody on wordpress.com has the unfiltered_html capability so kses strips the onclick, making this a non-issue. This only affects users with unfiltered_html.

comment:9 in reply to: ↑ 3 foolswisdom7 years ago

  • Milestone changed from 2.3 to 2.4

Replying to andy:

foolswisdom: nobody on wordpress.com has the unfiltered_html capability so kses strips the onclick, making this a non-issue. This only affects users with unfiltered_html.

Gotcha, it does work in Firefox at WordPress.com .

Replying to foolswisdom:

Replying to rob1n:

Also, I don't know if this is necessary to be fixed, as I never even thought of dragging and dropping before I read this ticket. The controls provided do the job fine...

I see it all the time on WordPress.com , it is an intuitive action.

I think in my comment I was referring to people trying to drag and drop an image. Which is an intuitive action to many people based on my experience helping people at WordPress.com and using other applications. As you described Andy is disabled for IE (including IE7 maybe they have smartened up?).

comment:10 azaozz6 years ago

  • Milestone 2.5 deleted
  • Resolution set to invalid
  • Status changed from new to closed

In WordPress 2.5 the new Media Library is in overlay, so it's not possible to drag images to the editor. Not sure how to close this, but since it's currently invalid...

Note: See TracTickets for help on using tickets.