diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js index f578d4a..b9db48c 100644 --- a/core/misc/tabledrag.js +++ b/core/misc/tabledrag.js @@ -99,6 +99,12 @@ Drupal.tableDrag = function (table, tableSettings) { testRow.remove(); } + // Initialize the specified columns (for example, weight or parent columns) + // to show or hide according to user preference. This aids accessibility + // so that, e.g., screen reader users can choose to enter weight values and + // manipulate form elements directly, rather than using drag-and-drop.. + self.initColumns(); + // Make each applicable row draggable. // Match immediate children of the parent element to allow nesting. $table.find('> tr.draggable, > tbody > tr.draggable').each(function () { self.makeDraggable(this); }); @@ -114,11 +120,8 @@ Drupal.tableDrag = function (table, tableSettings) { .parent() ); - // Initialize the specified columns (for example, weight or parent columns) - // to show or hide according to user preference. This aids accessibility - // so that, e.g., screen reader users can choose to enter weight values and - // manipulate form elements directly, rather than using drag-and-drop.. - self.initColumns(); + // Toggle the visibility of the weights column. + this.displayColumns(showWeight); // Add mouse bindings to the document. The self variable is passed along // as event handlers do not have direct access to the tableDrag object. @@ -168,7 +171,6 @@ Drupal.tableDrag.prototype.initColumns = function () { } } } - this.displayColumns(showWeight); }; /** @@ -306,14 +308,14 @@ Drupal.tableDrag.prototype.makeDraggable = function (item) { // Create the handle. var handle = $('
 
').attr('title', Drupal.t('Drag to re-order')); // Insert the handle after indentations (if any). - var $indentationLast = $item.find('td:first .indentation:last'); + var $indentationLast = $item.find('td:not(.tabledrag-hide):first .indentation:last'); if ($indentationLast.length) { $indentationLast.after(handle); // Update the total width of indentation in this entire table. self.indentCount = Math.max($item.find('.indentation').length, self.indentCount); } else { - $item.find('td:first').prepend(handle); + $item.find('td:not(.tabledrag-hide):first').prepend(handle); } // Add hover action for the handle. @@ -1136,7 +1138,7 @@ Drupal.tableDrag.prototype.row.prototype.indent = function (indentDiff) { this.indents--; } else { - $group.find('td:first').prepend(Drupal.theme('tableDragIndentation')); + $group.find('td:not(.tabledrag-hide):first').prepend(Drupal.theme('tableDragIndentation')); this.indents++; } } @@ -1216,7 +1218,7 @@ Drupal.tableDrag.prototype.row.prototype.removeIndentClasses = function () { */ Drupal.tableDrag.prototype.row.prototype.markChanged = function () { var marker = Drupal.theme('tableDragChangedMarker'); - var cell = $(this.element).find('td:first'); + var cell = $(this.element).find('td:not(.tabledrag-hide):first'); if (cell.find('abbr.tabledrag-changed').length === 0) { cell.append(marker); }