Mobile focus
parent
42a80d2726
commit
d8326609f2
|
@ -165,7 +165,8 @@ export default {
|
||||||
this.mobileActive = false;
|
this.mobileActive = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
focus(this.$refs.menubutton);
|
focus(this.$refs.menubutton);
|
||||||
}, 0);
|
this.scrollInView();
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.activeItem = null;
|
this.activeItem = null;
|
||||||
|
@ -287,7 +288,11 @@ export default {
|
||||||
this.focusedItemInfo = { index, key, parentKey };
|
this.focusedItemInfo = { index, key, parentKey };
|
||||||
|
|
||||||
this.dirty = !root;
|
this.dirty = !root;
|
||||||
|
|
||||||
|
if (!this.mobileActive) {
|
||||||
focus(this.menubar);
|
focus(this.menubar);
|
||||||
|
this.menubar.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (grouped) {
|
if (grouped) {
|
||||||
this.onItemChange(event);
|
this.onItemChange(event);
|
||||||
|
@ -603,10 +608,16 @@ export default {
|
||||||
},
|
},
|
||||||
scrollInView(index = -1) {
|
scrollInView(index = -1) {
|
||||||
const id = index !== -1 ? `${this.id}_${index}` : this.focusedItemId;
|
const id = index !== -1 ? `${this.id}_${index}` : this.focusedItemId;
|
||||||
const element = findSingle(this.menubar, `li[id="${id}"]`);
|
let element;
|
||||||
|
|
||||||
|
if (id === null && this.queryMatches) {
|
||||||
|
element = this.$refs.menubutton;
|
||||||
|
} else {
|
||||||
|
element = findSingle(this.menubar, `li[id="${id}"]`);
|
||||||
|
}
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'start' });
|
element.scrollIntoView && element.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createProcessedItems(items, level = 0, parent = {}, parentKey = '', columnIndex) {
|
createProcessedItems(items, level = 0, parent = {}, parentKey = '', columnIndex) {
|
||||||
|
|
Loading…
Reference in New Issue