[英]Accessibility on vue.js app - Show div when click Tab Key
I will create a menu with jump marks for accessibility that is only visible when the tab key on the keyboard is clicked.我将创建一个带有可访问性跳转标记的菜单,该菜单仅在单击键盘上的 Tab 键时可见。 How can I implement this in Vuetify?
如何在 Vuetify 中实现这一点? is there a way to use something like @click for this?
有没有办法为此使用@click之类的东西? This is my html code for the menu:
这是菜单的 html 代码:
<template> <div class="m-block-tab-jump-sections" data-module="tab-jump-sections" v-on:click.tab="onClick"> <div class="jump-sections js-sections h-break-in"> <a href="#tab-jump-section--metamenu" class="jump-link" title="" target="" tabindex="50"> zur Top-Navigation </a> </div> </div> </template>
In order to capture the tab on the entire page, you may need to look at putting the following on the app element:为了捕获整个页面上的选项卡,您可能需要查看将以下内容放在 app 元素上:
v-on:keydown.tab='handleTab'
Now you can open a menu or do other actions in the handler.现在您可以在处理程序中打开菜单或执行其他操作。
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: () => ({
showMenu: false,
clickcount: 0,
items: [
{ title: 'Click Me' },
{ title: 'Click Me' },
{ title: 'Click Me' },
{ title: 'Click Me 2' },
],
}),
methods: {
handleTab(event) {
this.showMenu = true;
}
}
})
<div id="app" v-on:keydown.tab='handleTab'>
<v-app id="inspire">
<div class="text-center">
<v-menu offset-y v-model='showMenu'>
<template v-slot:activator="{ on }">
<v-btn
color="primary"
dark
v-on:focus='handleTab'
>
Dropdown
</v-btn>
</template>
<v-list>
<v-list-item
v-for="(item, index) in items"
:key="index"
@click=""
>
<v-list-item-title>{{ item.title }}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</div>
<v-text-field></v-text-field>
<v-text-field></v-text-field>
<v-text-field></v-text-field>
<v-text-field></v-text-field>
</v-app>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.