Ticket #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: | ||
| Blocking: | Blocked by: |
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
comment:2 Changed 4 years ago by joern.zaefferer
- Status changed from new to closed
- Resolution set to invalid
See comment by garethky.
comment:3 Changed 4 years ago by joern.zaefferer
- Status changed from closed to reopened
- Resolution invalid deleted
Related ticket: #4541
comment:4 Changed 4 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 3 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:8 Changed 3 months ago by tj.vantoll
- Status changed from open to closed
- Resolution set to notabug
This works just fine as long as you do not use disableSelection (which is deprecated and will be removed completely, see #7756).
comment:9 Changed 2 months ago by jmorris
This does not work just fine if you use items and cancel parameters: http://jsfiddle.net/jcmorris/DxkZw/1/
comment:10 Changed 2 months ago by scott.gonzalez
@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 2 months ago by jmorris
@scott.gonzalez Including the form controls did the trick. Thank you.


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() {
});
Suggest using a more specific selector so that input boxes are not caught up in this.