Note that there are some explanatory texts on larger screens.

plurals
  1. POMake text selectable in a textarea within a jQuery Sortable parent
    primarykey
    data
    text
    <p>I have a table whose body I've made sortable using jQuery UI's Sortable function. Within this sortable table, I have a textarea which allows the user to enter comments about a given table entry.</p> <pre><code>&lt;table id="status"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Comment&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class="dragHandle"&gt;Jason&lt;/td&gt; &lt;td&gt;&lt;textarea class="commentBox"&gt;&lt;/textarea&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>And the javascript to make the table sortable (with a helper function for making tables sortable I found online)</p> <pre><code>// Return a helper with preserved width of cells var fixHelper = function(e, ui) { ui.children().each(function() { $(this).width($(this).width()); }); return ui; }; $("#status").sortable({ helper: fixHelper, axis: 'y', handle: '.dragHandle' }).disableSelection(); </code></pre> <p>Text entry into this textarea works fine, however when I try to select text within the textarea, nothing happens. Even using Shift+Arrow Keys does not behave as I would expect.</p> <p>How do I make a textarea's text selectable while still making the entire table sortable?</p> <p>Already Attempted:</p> <ul> <li><p>Doing a sortable "destroy" on the table when a textarea gets focus to try and temporarily allow selectability, but even after the destroy, text selection is still wonky.</p></li> <li><p>Setting the 'handle' property of the sortable to make only the Name field sortable</p></li> <li><p>Setting the 'disable' property of the sortable to disable when initiated from textareas</p></li> <li><p>Capturing the mousedown/mouseup events in the textarea (or a div containing the textarea) and calling event.stopPropagation()</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload