Skip to content

Commit 8bff4c4

Browse files
committed
created README
1 parent b88a2e6 commit 8bff4c4

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

README.MD

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# vue-a11y-click
2+
It helps you handling click events on element which are not natively clickable - like `<img>` or `<div></div>`. This package provides custom directive which will add `tabindex` attribute to an element. Then it will trigger `click` event when focused and user press `enter`. In addition it will change `aria-pressed` property.
3+
4+
5+
6+
## Install
7+
#### NPM
8+
```shell
9+
npm install -S vue-a11y-click
10+
```
11+
12+
#### Yarn
13+
```shell
14+
yarn add vue-a11y-click
15+
```
16+
17+
## How to use
18+
In your `main.js`
19+
```javascript
20+
import Vue from 'vue'
21+
import VueA11YClick from 'vue-a11y-click'
22+
23+
Vue.use(VueA11YClick)
24+
```
25+
26+
Then you can use it in component
27+
```vue
28+
<template>
29+
<div
30+
class="baseCard--clickable"
31+
@click="handleClick"
32+
v-a11y-click
33+
>
34+
<!-- clickable content -->
35+
</div>
36+
</template>
37+
38+
<script>
39+
export default {
40+
name: 'BaseCard',
41+
methods: {
42+
handleClick() {
43+
// ...
44+
}
45+
}
46+
//...
47+
}
48+
</script>
49+
```
50+
51+
## Using with HTML files
52+
```html
53+
<body>
54+
<div id="app">
55+
56+
<div
57+
class="card"
58+
@click="triggerPopup"
59+
v-a11y-click
60+
>
61+
<!-- clickable content -->
62+
</div>
63+
</div>
64+
65+
<script src="https://unpkg.com/vue"></script>
66+
<script src="https://unpkg.com/vue-skip-to"></script>
67+
<script>
68+
Vue.use(VueSkipTo)
69+
new Vue({
70+
el: "#app",
71+
})
72+
73+
</script>
74+
</body>
75+
</html>
76+
```
77+
78+
## Roadmap
79+
80+
- [] Live demo
81+
- [] E2E Tests

0 commit comments

Comments
 (0)