makeup-listbox
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -109,3 +109,4 @@ "use strict"; | ||
this._unobserveMutations(); | ||
if (_indexInBounds(index, this.items.length)) { | ||
var itemEl = this.items[index]; | ||
if (itemEl && itemEl.getAttribute('aria-disabled') !== 'true') { | ||
var matchingItem = this.items[index]; | ||
@@ -127,3 +128,4 @@ matchingItem.setAttribute('aria-selected', 'true'); | ||
this._unobserveMutations(); | ||
if (_indexInBounds(index, this.items.length)) { | ||
var itemEl = this.items[index]; | ||
if (itemEl && itemEl.getAttribute('aria-disabled') !== 'true') { | ||
var matchingItem = this.items[index]; | ||
@@ -162,3 +164,4 @@ matchingItem.setAttribute('aria-selected', 'false'); | ||
var isTolElSelected = toEl.getAttribute('aria-selected') === 'true'; | ||
if (this._options.autoSelect === false && isTolElSelected === false) { | ||
var isTolElDisabled = toEl.getAttribute('aria-disabled') === 'true'; | ||
if (!isTolElDisabled && this._options.autoSelect === false && isTolElSelected === false) { | ||
// todo: this.select() should take care of unselecting any existing selections | ||
@@ -197,4 +200,1 @@ this.unselect(this.index); | ||
} | ||
function _indexInBounds(index, size) { | ||
return index > -1 && index < size; | ||
} |
@@ -95,3 +95,4 @@ import * as ActiveDescendant from "makeup-active-descendant"; | ||
this._unobserveMutations(); | ||
if (_indexInBounds(index, this.items.length)) { | ||
const itemEl = this.items[index]; | ||
if (itemEl && itemEl.getAttribute("aria-disabled") !== "true") { | ||
const matchingItem = this.items[index]; | ||
@@ -113,3 +114,4 @@ matchingItem.setAttribute("aria-selected", "true"); | ||
this._unobserveMutations(); | ||
if (_indexInBounds(index, this.items.length)) { | ||
const itemEl = this.items[index]; | ||
if (itemEl && itemEl.getAttribute("aria-disabled") !== "true") { | ||
const matchingItem = this.items[index]; | ||
@@ -144,3 +146,4 @@ matchingItem.setAttribute("aria-selected", "false"); | ||
const isTolElSelected = toEl.getAttribute("aria-selected") === "true"; | ||
if (this._options.autoSelect === false && isTolElSelected === false) { | ||
const isTolElDisabled = toEl.getAttribute("aria-disabled") === "true"; | ||
if (!isTolElDisabled && this._options.autoSelect === false && isTolElSelected === false) { | ||
this.unselect(this.index); | ||
@@ -174,7 +177,4 @@ this.select(toElIndex); | ||
} | ||
function _indexInBounds(index, size) { | ||
return index > -1 && index < size; | ||
} | ||
export { | ||
src_default as default | ||
}; |
{ | ||
"name": "makeup-listbox", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"lockfileVersion": 2, | ||
@@ -9,6 +9,6 @@ "requires": true, | ||
"name": "makeup-listbox", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"license": "MIT", | ||
"dependencies": { | ||
"makeup-active-descendant": "~0.6.0", | ||
"makeup-active-descendant": "~0.6.1", | ||
"makeup-prevent-scroll-keys": "~0.2.0" | ||
@@ -18,5 +18,5 @@ } | ||
"node_modules/makeup-active-descendant": { | ||
"version": "0.6.0", | ||
"resolved": "https://registry.npmjs.org/makeup-active-descendant/-/makeup-active-descendant-0.6.0.tgz", | ||
"integrity": "sha512-hpnHaUx3cisVA8HFo+8w5tny6XHUhB7/uFZDRmllhgNssJzQEqN+5Azk3XbGu3TNtsL8IQdupFPNXkvjaYPd2w==", | ||
"version": "0.6.1", | ||
"resolved": "https://registry.npmjs.org/makeup-active-descendant/-/makeup-active-descendant-0.6.1.tgz", | ||
"integrity": "sha512-WL8q0vbDJFORXPuw5xtYTALWlizRd1k4F5HX/roCA66d9zBrOZdsBZXu0HTqzOVdIZmBQcTqKqZe8JMkM+txnA==", | ||
"dependencies": { | ||
@@ -62,5 +62,5 @@ "makeup-navigation-emitter": "~0.6.0", | ||
"makeup-active-descendant": { | ||
"version": "0.6.0", | ||
"resolved": "https://registry.npmjs.org/makeup-active-descendant/-/makeup-active-descendant-0.6.0.tgz", | ||
"integrity": "sha512-hpnHaUx3cisVA8HFo+8w5tny6XHUhB7/uFZDRmllhgNssJzQEqN+5Azk3XbGu3TNtsL8IQdupFPNXkvjaYPd2w==", | ||
"version": "0.6.1", | ||
"resolved": "https://registry.npmjs.org/makeup-active-descendant/-/makeup-active-descendant-0.6.1.tgz", | ||
"integrity": "sha512-WL8q0vbDJFORXPuw5xtYTALWlizRd1k4F5HX/roCA66d9zBrOZdsBZXu0HTqzOVdIZmBQcTqKqZe8JMkM+txnA==", | ||
"requires": { | ||
@@ -67,0 +67,0 @@ "makeup-navigation-emitter": "~0.6.0", |
{ | ||
"name": "makeup-listbox", | ||
"description": "A JavaScript class representing an ARIA listbox", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": "./dist/cjs/index.js", | ||
@@ -24,3 +24,3 @@ "module": "./dist/mjs/index.js", | ||
"makeup-prevent-scroll-keys": "~0.2.0", | ||
"makeup-active-descendant": "~0.6.0" | ||
"makeup-active-descendant": "~0.6.1" | ||
}, | ||
@@ -27,0 +27,0 @@ "files": [ |
22347