Skip to content

Commit c20215e

Browse files
committed
docs(Api, RWExample): add a11y news props
1 parent 1e37d52 commit c20215e

File tree

3 files changed

+54
-26
lines changed

3 files changed

+54
-26
lines changed

src-docs/app/pages/ExamplesRealWorldPage.vue

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,35 @@
22
<section class="c-main__sub-section">
33
<h3 class="c-main__sub-heading u-gutter">Real world example</h3>
44
<div class="c-item u-gutter">
5+
<div class="c-item__description">
6+
<ul>
7+
<li>Custom width</li>
8+
<li>Custom styles</li>
9+
<li>a11y attributes</li>
10+
<li>Listening to <code>closed</code> event</li>
11+
<li>Listening to <code>opened</code> event</li>
12+
</ul>
13+
</div>
514
<h5 class="c-item__sub-heading">Code:</h5>
615
<div class="c-item__code-wrapper" v-html="snippets.rw01"></div>
716
<h5 class="c-item__sub-heading">Result:</h5>
817
<div class="c-play-around">
918
<wv-off-canvas
10-
overlay-background="transparent"
1119
class="nav"
1220
v-transfer-dom
13-
width="20rem"
1421
wrap-ref="main"
1522
ref="nav"
23+
overlay-background="transparent"
24+
role="navigation"
25+
aria-labelledby="title"
1626
@closed="onClose"
1727
@opened="onOpen"
1828
>
19-
<h1>Navigation</h1>
29+
<button v-off-canvas:toggle="nav">Close</button>
30+
<h1 id="title">Navigation</h1>
2031
<a v-off-canvas:toggle="nav" href="https://wovue.github.io/off-canvas/#!/examples/real-world">Link to someplace</a>
2132
</wv-off-canvas>
22-
<button v-off-canvas:toggle="nav" type="button">Open Nav</button>
33+
<button v-off-canvas:toggle="nav" type="button">Open</button>
2334
</div>
2435
</div>
2536
</section>
@@ -39,10 +50,10 @@
3950
},
4051
methods: {
4152
onClose () {
42-
window.alert('OffCanvas closed')
53+
console.log('OffCanvas closed')
4354
},
4455
onOpen () {
45-
window.alert('OffCanvas opened')
56+
console.log('OffCanvas opened')
4657
}
4758
}
4859
}
@@ -52,6 +63,7 @@
5263
.nav {
5364
background-color: #400255;
5465
color: #ffffff;
66+
max-width: 25rem;
5567
padding: 2rem 0;
5668
text-align: center;
5769
}

src-docs/app/pages/HomeApiPage.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,29 @@
8585
default: '`"rgba(0, 0, 0, .5)"`',
8686
description: 'Overlay background color.'
8787
}, {
88-
name: 'closeOnEsc `new`',
88+
name: 'closeOnEsc',
8989
type: '`Boolean`',
9090
required: 'false',
9191
default: '`true`',
9292
description: 'This determines if pressing the `esc` key will close the OffCanvas.'
9393
}, {
94-
name: 'closeOnOutsideClick `new`',
94+
name: 'closeOnOutsideClick',
9595
type: '`Boolean`',
9696
required: 'false',
9797
default: '`true`',
9898
description: 'This determines if clicking on the overlay will close the OffCanvas.'
99+
}, {
100+
name: 'role `new`',
101+
type: '`String`',
102+
required: 'false',
103+
default: '`false`',
104+
description: 'OffCanvas `role` attribute.'
105+
}, {
106+
name: 'ariaLabelledby `new`',
107+
type: '`String`',
108+
required: 'false',
109+
default: '`false`',
110+
description: 'OffCanvas `aria-labelledby` attribute.'
99111
}
100112
],
101113
events: [

src-docs/app/snippets/example-rw-01.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,35 @@
11
```html
2-
<div>
3-
<wv-off-canvas-wrap ref="main">
4-
<button v-off-canvas:toggle="nav">Open Nav</button>
5-
</wv-off-canvas-wrap>
2+
<wv-off-canvas-wrap ref="main">
3+
...
4+
<button v-off-canvas:toggle="nav">Open</button>
5+
...
6+
</wv-off-canvas-wrap>
67

7-
<wv-off-canvas
8-
class="nav"
9-
ref="nav"
10-
wrap-ref="main"
11-
overlay-background="transparent"
12-
@opened="onOpen"
13-
@closed="onClose"
14-
>
15-
<h1>Navigation</h1>
16-
<a v-off-canvas:toggle="nav">Link to someplace</a>
17-
</wv-off-canvas>
18-
</div>
8+
<wv-off-canvas
9+
class="nav"
10+
ref="nav"
11+
wrap-ref="main"
12+
overlay-background="transparent"
13+
role="navigation"
14+
aria-labelledby="title"
15+
@opened="onOpen"
16+
@closed="onClose"
17+
>
18+
<button v-off-canvas:toggle="nav">Close</button>
19+
<h1 id="title">Navigation</h1>
20+
<a v-off-canvas:toggle="nav">Link to someplace</a>
21+
</wv-off-canvas>
1922
```
2023

2124
```js
2225
export default {
2326
// ...
2427
methods: {
2528
onOpen () {
26-
window.alert('OffCanvas opened')
29+
console.log('OffCanvas opened')
2730
},
2831
onClose () {
29-
window.alert('OffCanvas closed')
32+
console.log('OffCanvas closed')
3033
}
3134
}
3235
}
@@ -36,6 +39,7 @@ export default {
3639
.nav {
3740
background-color: #400255;
3841
color: #ffffff;
42+
max-width: 25rem;
3943
padding: 2rem 0;
4044
text-align: center;
4145
}

0 commit comments

Comments
 (0)