Skip to content

Commit 31fe0e3

Browse files
committed
✨ Updated to a11y-dialog@5.1.0 and added way to disable native dialog element
1 parent db7bb63 commit 31fe0e3

File tree

5 files changed

+39
-17
lines changed

5 files changed

+39
-17
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Vue A11yDialog
22

3-
This is a Vue.js wrapper component for [`a11y-dialog`](https://github.com/edenspiekermann/a11y-dialog) ([**demo**](https://codesandbox.io/s/rj20wr1kpp)).
3+
This is a Vue.js wrapper component for [`a11y-dialog@5.1.0`](https://github.com/edenspiekermann/a11y-dialog) ([**demo**](https://codesandbox.io/s/rj20wr1kpp)).
44

55
- [Install](#install)
66
- [Usage](#usage)
@@ -89,6 +89,18 @@ export default {
8989

9090
> All `a11y-dialog` instance methods are available, see their [docs](https://github.com/edenspiekermann/a11y-dialog#js-api) for more.
9191
92+
### `disable-native`
93+
- **Property**: `disable-native`
94+
- **Type**: `Boolean`
95+
- **Default**: `false`
96+
- **Description**: Per default we're using the native `<dialog>` element. However, if you want to disable that and use a `<div role="dialog">` instead, you can just do that by adding this attribute. This gives you full control (and responsibilites) over styling. Read the [`a11y-dialog` Styling layer documentation](http://edenspiekermann.github.io/a11y-dialog/#styling-layer) for more information.
97+
- **Usage**:
98+
```html
99+
<a11y-dialog disable-native>
100+
<!-- ... -->
101+
</a11y-dialog>
102+
```
103+
92104
### `id`
93105
- **Property**: `id`
94106
- **Type**: `String`

dist/vue-a11y-dialog.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"url": "https://github.com/morkro/vue-a11y-dialog"
3131
},
3232
"dependencies": {
33-
"a11y-dialog": "^5.0.2"
33+
"a11y-dialog": "^5.1.0"
3434
},
3535
"peerDependencies": {
3636
"vue": "2.x"
@@ -40,7 +40,7 @@
4040
"babel-preset-env": "^1.7.0",
4141
"eslint": "^4.19.1",
4242
"eslint-plugin-vue": "^4.5.0",
43-
"rollup": "^0.60.4",
43+
"rollup": "^0.60.7",
4444
"rollup-plugin-babel": "^3.0.4",
4545
"rollup-plugin-babel-minify": "^5.0.0",
4646
"rollup-plugin-commonjs": "^9.1.3",

src/A11yDialog.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
<template>
22
<div :id="id" :class="classNames.base" ref="rootElement">
33
<div
4+
data-a11y-dialog-hide
45
tabIndex="-1"
56
:class="classNames.overlay"
67
@click="close" />
7-
<dialog :class="classNames.element" :aria-labelledby="titleId">
8+
9+
<component :is="dialogElement"
10+
role="dialog"
11+
:class="classNames.element"
12+
:aria-labelledby="titleId">
813
<div role="document" :class="classNames.document">
914
<button
15+
data-a11y-dialog-hide
1016
type="button"
1117
:aria-label="closeButtonLabel"
1218
@click="close"
@@ -22,7 +28,7 @@
2228

2329
<slot />
2430
</div>
25-
</dialog>
31+
</component>
2632
</div>
2733
</template>
2834

@@ -37,12 +43,16 @@
3743
appRoot: { type: [String, Array], required: true },
3844
classNames: { type: Object, default: () => ({}) },
3945
titleId: { type: String },
40-
closeButtonLabel: { type: String, default: 'Close this dialog window' }
46+
closeButtonLabel: { type: String, default: 'Close this dialog window' },
47+
disableNative: { type: Boolean, default: false }
4148
},
4249
4350
computed: {
4451
fullTitleId () {
4552
return this.titleId || this.id + '-title'
53+
},
54+
dialogElement () {
55+
return this.disableNative ? 'div' : 'dialog'
4656
}
4757
},
4858

0 commit comments

Comments
 (0)