Fixed #3553 - PanelMenu: Link items can't be opened with a keyboard (slot issue)
parent
10bdf93f04
commit
86a34cde87
|
@ -70,10 +70,18 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
id: this.$attrs.id,
|
||||||
activeItem: null
|
activeItem: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
'$attrs.id': function (newVal) {
|
||||||
|
this.id = newVal || UniqueComponentId();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.id = this.id || UniqueComponentId();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getItemProp(item, name) {
|
getItemProp(item, name) {
|
||||||
return item ? ObjectUtils.getItemValue(item[name]) : undefined;
|
return item ? ObjectUtils.getItemValue(item[name]) : undefined;
|
||||||
|
@ -250,11 +258,6 @@ export default {
|
||||||
return ['p-submenu-icon', this.isItemActive(item) ? 'pi pi-chevron-down' : 'pi pi-chevron-right'];
|
return ['p-submenu-icon', this.isItemActive(item) ? 'pi pi-chevron-down' : 'pi pi-chevron-right'];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
id() {
|
|
||||||
return this.$attrs.id || UniqueComponentId();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
PanelMenuList: PanelMenuList
|
PanelMenuList: PanelMenuList
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@ export default {
|
||||||
onEnterKey(event) {
|
onEnterKey(event) {
|
||||||
if (ObjectUtils.isNotEmpty(this.focusedItem)) {
|
if (ObjectUtils.isNotEmpty(this.focusedItem)) {
|
||||||
const element = DomHandler.findSingle(this.$el, `li[id="${`${this.focusedItemId}`}"]`);
|
const element = DomHandler.findSingle(this.$el, `li[id="${`${this.focusedItemId}`}"]`);
|
||||||
const anchorElement = element && DomHandler.findSingle(element, '.p-menuitem-link');
|
const anchorElement = element && (DomHandler.findSingle(element, '.p-menuitem-link') || DomHandler.findSingle(element, 'a,button'));
|
||||||
|
|
||||||
anchorElement ? anchorElement.click() : element && element.click();
|
anchorElement ? anchorElement.click() : element && element.click();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue