Update TreeNode.vue
parent
f506a782fd
commit
3e8fbf4c3a
|
@ -257,7 +257,9 @@ export default {
|
||||||
this.setAllNodesTabIndexes();
|
this.setAllNodesTabIndexes();
|
||||||
},
|
},
|
||||||
setAllNodesTabIndexes() {
|
setAllNodesTabIndexes() {
|
||||||
const nodes = DomHandler.find(this.$refs.currentNode.closest('[data-pc-section="container"]'), '[data-pc-section="treeitem"]');
|
const nodes = DomHandler.find(this.$refs.currentNode.closest('[data-pc-section="container"]'), '[role="treeitem"]');
|
||||||
|
|
||||||
|
console.log(nodes);
|
||||||
|
|
||||||
const hasSelectedNode = [...nodes].some((node) => node.getAttribute('aria-selected') === 'true' || node.getAttribute('aria-checked') === 'true');
|
const hasSelectedNode = [...nodes].some((node) => node.getAttribute('aria-selected') === 'true' || node.getAttribute('aria-checked') === 'true');
|
||||||
|
|
||||||
|
@ -277,7 +279,7 @@ export default {
|
||||||
},
|
},
|
||||||
setTabIndexForSelectionMode(event, nodeTouched) {
|
setTabIndexForSelectionMode(event, nodeTouched) {
|
||||||
if (this.selectionMode !== null) {
|
if (this.selectionMode !== null) {
|
||||||
const elements = [...DomHandler.find(this.$refs.currentNode.parentElement, '[data-pc-section="treeitem"]')];
|
const elements = [...DomHandler.find(this.$refs.currentNode.parentElement, '[role="treeitem"]')];
|
||||||
|
|
||||||
event.currentTarget.tabIndex = nodeTouched === false ? -1 : 0;
|
event.currentTarget.tabIndex = nodeTouched === false ? -1 : 0;
|
||||||
|
|
||||||
|
@ -384,7 +386,7 @@ export default {
|
||||||
getParentNodeElement(nodeElement) {
|
getParentNodeElement(nodeElement) {
|
||||||
const parentNodeElement = nodeElement.parentElement.parentElement;
|
const parentNodeElement = nodeElement.parentElement.parentElement;
|
||||||
|
|
||||||
return DomHandler.getAttribute(parentNodeElement, 'data-pc-section') === 'treeitem' ? parentNodeElement : null;
|
return DomHandler.getAttribute(parentNodeElement, 'role') === 'treeitem' ? parentNodeElement : null;
|
||||||
},
|
},
|
||||||
focusNode(element) {
|
focusNode(element) {
|
||||||
element.focus();
|
element.focus();
|
||||||
|
@ -393,7 +395,7 @@ export default {
|
||||||
return this.selectionMode === 'checkbox';
|
return this.selectionMode === 'checkbox';
|
||||||
},
|
},
|
||||||
isSameNode(event) {
|
isSameNode(event) {
|
||||||
return event.currentTarget && (event.currentTarget.isSameNode(event.target) || event.currentTarget.isSameNode(event.target.closest('[data-pc-section="treeitem"]')));
|
return event.currentTarget && (event.currentTarget.isSameNode(event.target) || event.currentTarget.isSameNode(event.target.closest('[role="treeitem"]')));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
Loading…
Reference in New Issue