Opened 14 years ago

Closed 11 years ago

Last modified 9 years ago

#4429 closed bug (notabug)

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

Change History (12)

comment:1 Changed 14 years ago by garethky

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.

comment:2 Changed 14 years ago by Jörn Zaefferer

Resolution: invalid
Status: newclosed

See comment by garethky.

comment:3 Changed 14 years ago by Jörn Zaefferer

Resolution: invalid
Status: closedreopened

Related ticket: #4541

comment:4 Changed 14 years ago by kae

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();
  });

comment:5 Changed 13 years ago by djo69

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

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

Milestone: TBD2.0.0

comment:7 Changed 11 years ago by mikesherov

Status: reopenedopen

comment:8 Changed 11 years ago by tj.vantoll

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/

comment:9 Changed 10 years ago by jmorris

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

Last edited 10 years ago by jmorris (previous) (diff)

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

@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

comment:11 Changed 10 years ago by jmorris

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

comment:12 Changed 9 years ago by gigolnet

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

e.stopImmediatePropagation();

});

Last edited 9 years ago by gigolnet (previous) (diff)
Note: See TracTickets for help on using tickets.