Commit 57d26a4a by Tim Krones

Don't set "tabindex" on items if they have already been placed.

There is no need to TAB to them anymore, so they don't need this attribute.
parent 994cb556
...@@ -58,8 +58,13 @@ ...@@ -58,8 +58,13 @@
if (item.has_image) { if (item.has_image) {
className += " " + "option-with-image"; className += " " + "option-with-image";
} }
var attributes = {
'draggable': !item.drag_disabled,
'aria-grabbed': item.grabbed,
'data-value': item.value,
'data-drag-disabled': item.drag_disabled
};
var style = {}; var style = {};
var tabindex = 0;
if (item.background_color) { if (item.background_color) {
style['background-color'] = item.background_color; style['background-color'] = item.background_color;
} }
...@@ -72,8 +77,9 @@ ...@@ -72,8 +77,9 @@
if (item.is_placed) { if (item.is_placed) {
style.left = item.x_percent + "%"; style.left = item.x_percent + "%";
style.top = item.y_percent + "%"; style.top = item.y_percent + "%";
tabindex = -1; // If an item has been placed it can no longer be interacted with, } else {
// so remove the ability to move focus to it using the keyboard // If an item has not been placed it must be possible to move focus to it using the keyboard:
attributes.tabindex = 0;
} }
// Define children // Define children
var children = [ var children = [
...@@ -98,19 +104,15 @@ ...@@ -98,19 +104,15 @@
} }
children.splice(1, 0, item_content); children.splice(1, 0, item_content);
return ( return (
h('div.option', h(
'div.option',
{ {
key: item.value, key: item.value,
className: className, className: className,
attributes: { attributes: attributes,
'tabindex': tabindex,
'draggable': !item.drag_disabled,
'aria-grabbed': item.grabbed,
'data-value': item.value,
'data-drag-disabled': item.drag_disabled
},
style: style style: style
}, children },
children
) )
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment