tabindex does now almost work properly when having multiple stories in edit mode at a given time

* tab index is concise inside one story
* tab index is not concise between the story elements. The tab index is defined in the order a story was put into edit mode
pull/6827/head
Jens Ulferts 14 years ago
parent 935af97973
commit 611c13d895
  1. 14
      assets/javascripts/app/model.js

@ -103,6 +103,16 @@ RB.Model = (function ($) {
var editor = this.getEditor(),
self = this;
var maxTabIndex = 0;
$('.stories .editors .editor').each(function(index) {
var value;
value = parseInt($(this).attr('tabindex'), 10);
if (maxTabIndex < value) {
maxTabIndex = value;
}
});
this.$.find('.editable').each(function (index) {
var field, fieldType, fieldLabel, fieldName, fieldOrder, input;
@ -110,7 +120,7 @@ RB.Model = (function ($) {
field = $(this);
fieldName = field.attr('fieldname');
fieldLabel = field.attr('fieldlabel');
fieldOrder = field.attr('fieldorder');
fieldOrder = parseInt(field.attr('fieldorder'), 10);
fieldType = field.attr('fieldtype') || 'input';
if (!fieldLabel) {
@ -127,7 +137,7 @@ RB.Model = (function ($) {
}
input.removeAttr('id');
input.attr('name', fieldName);
input.attr('tabindex', fieldOrder);
input.attr('tabindex', fieldOrder + maxTabIndex);
input.addClass(fieldName);
input.addClass('editor');
input.removeClass('template');

Loading…
Cancel
Save