Opened 10 years ago

Closed 7 years ago

Last modified 7 years ago

#5129 closed bug (fixed)

Sortable: Unable to use an image as a placeholder in Firefox

Reported by: zerxer Owned by: Scott González
Priority: minor Milestone: 1.10.2
Component: ui.sortable Version: 1.7.2
Keywords: sortable image placeholder Cc:
Blocked by: Blocking:

Description

From http://forum.jquery.com/topic/using-sortables-on-images-causes-placeholder-issues

Basically, see here: http://jsbin.com/ayige

Firefox (and possibly some other browsers?) do not let you style an empty IMG tag with a width/height, so there's a broken placeholder under your sortable. Chrome seems to do just fine though and apply the width/height to the image.

I've fixed this on my site once already in the past (forgot to report this), but noticed it pop up again when I updated to the latest files. My fix was basically to put ".attr('src', 'url to a spacer gif')" in the _createPlaceholder function where it defines the "f" variable in the e.placeholder.element function.

Change History (7)

comment:1 Changed 10 years ago by rdworth

Another workaround would be to set display: inline-block in the css for ui-sortable-placeholder. See

http://jsbin.com/ayige/2

comment:2 Changed 7 years ago by Scott González

Milestone: 1.next2.0.0

comment:3 Changed 7 years ago by mikesherov

Status: newopen

comment:4 Changed 7 years ago by tj.vantoll

Summary: sortable: using sortables on images causes placeholder issuesSortable: Unable to use an image as a placeholder in Firefox

Confirmed this is still an issue on 1.10.1: http://jsbin.com/ayige/15. Adding img.ui-sortable-placeholder { display: inline-block; } fixes this.

I think we should either land that or close this as wontfix since this is a bit of an edge case that's easy to workaround. I'm leaning towards putting something in to handle this. Thoughts?

comment:5 Changed 7 years ago by Scott González

Owner: set to scott.gonzalez
Status: openassigned

I think the ideal fix is setting the src to match the item being sorted.

comment:6 Changed 7 years ago by Scott González

Resolution: fixed
Status: assignedclosed

Sortable: Copy the src of the original item when creating a placeholder from an image. Fixes #5129 - Sortable: Unable to use an image as a placeholder in Firefox.

Changeset: b9be6bb7ad107fd48b28e31df972b2037c47c2cb

comment:7 Changed 7 years ago by Scott González

Milestone: 2.0.01.10.2
Note: See TracTickets for help on using tickets.