Skip to main content

Search and Top Navigation

#4429 closed bug (notabug)

Opened April 02, 2009 11:57PM UTC

Closed February 28, 2013 03:53AM UTC

Last modified February 26, 2015 09:26PM UTC

Can't select text in inputs within sortables

Reported by: mikejestes Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.sortable Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Text inside a text input element cannot be selected when in a sortable area.

I have a demo here: http://mikejestes.com/demo/?demo=jquery_ui_sortable

Attachments (0)
Change History (12)

Changed April 05, 2009 06:34PM UTC by garethky comment:1

Somewhere in the sample code you linked to there is a call to dissableSelection();

This is actually a method in ui.core that stops the user from using the cursor to select text. Its in the sortable examples as well:

$(function() {

$("#sortable").sortable();

$("#sortable").disableSelection(); // this will disable text selection!

});

Suggest using a more specific selector so that input boxes are not caught up in this.

Changed May 07, 2009 11:06AM UTC by jzaefferer comment:2

resolution: → invalid
status: newclosed

See comment by garethky.

Changed May 19, 2009 05:14PM UTC by jzaefferer comment:3

resolution: invalid
status: closedreopened

Related ticket: #4541

Changed September 28, 2009 01:06PM UTC by kae comment:4

had the same problem myself today.

the solution (from the client-programming side) is to apply sortable to the event, then override the sortable's mouse events.

For example:

  $('#form_fields').sortable();
  $('#form_fields input').bind('click.sortable mousedown.sortable',function(ev){
    ev.target.focus();
  });

Changed June 17, 2010 02:08PM UTC by djo69 comment:5

Hey,

I have a similar pb.

In my fieldset sortable i want to unsortable an element ul insered on the fieldset .

Exemple :

<fieldset id='base'>

<ul id='panel'>

<li></li>

..

<ul>

</fieldset>

i want that when i click on my ul-panel the sortable mode was not activated, but just arond the ul.

I test : $('#form_fields').sortable();

$('#form_fields ul').bind('click.sortable mousedown.sortable',function(ev){

ev.target.focus();

});

but it's change anything.

Thanks in advance

Changed October 11, 2012 09:07PM UTC by scottgonzalez comment:6

milestone: TBD2.0.0

Changed October 27, 2012 08:19PM UTC by mikesherov comment:7

status: reopenedopen

Changed February 28, 2013 03:53AM UTC by tj.vantoll comment:8

resolution: → notabug
status: openclosed

This works just fine as long as you do not use disableSelection (which is deprecated and will be removed completely, see #7756).

http://jsfiddle.net/tj_vantoll/nttNj/

Changed March 28, 2013 06:03PM UTC by jmorris comment:9

_comment0: This does not work just fine if you use items and cancel parameters. \ \ http://jsfiddle.net/jcmorris/DxkZw/1/1364494104114334

This does not work just fine if you use items and cancel parameters: http://jsfiddle.net/jcmorris/DxkZw/1/

Changed March 28, 2013 06:33PM UTC by scottgonzalez comment:10

@jmorris Well, you specifically told the sortable not to cancel on input. You'll want to include form controls in your cancel option: http://api.jqueryui.com/sortable/#option-cancel

Changed March 28, 2013 09:30PM UTC by jmorris comment:11

@scott.gonzalez Including the form controls did the trick. Thank you.

Changed February 26, 2015 09:26PM UTC by gigolnet comment:12

_comment0: //For disable \ $("input, select, textarea").bind('mousedown.ui-disableSelection selectstart.ui-disableSelection', function(e){ \ e.stopImmediatePropagation(); \ });1424986052714210

$("input, select, textarea").bind('mousedown.ui-disableSelection selectstart.ui-disableSelection', function(e){

e.stopImmediatePropagation();

});