Skip to content

Commit ed90c91

Browse files
authored
Merge pull request #6 from morkro/fix/dialog-root-container
Fixes broken a11y by adding dialog container
2 parents 8244a8f + 744a822 commit ed90c91

File tree

7 files changed

+238
-150
lines changed

7 files changed

+238
-150
lines changed

.eslintrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ module.exports = {
2121
'allowFirstLine': true
2222
}
2323
}],
24+
'vue/component-name-in-template-casing': ['error', 'kebab-case', {
25+
'ignores': []
26+
}],
27+
'vue/html-closing-bracket-newline': ['error', {
28+
'singleline': 'never',
29+
'multiline': 'never'
30+
}],
2431
'indent': 'off',
2532
// allow paren-less arrow functions
2633
'arrow-parens': 'off',

README.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ Then use it as follows:
3535
Open dialog
3636
</button>
3737

38-
<a11y-dialog id="app-dialog" app-root="#app" @dialog-ref="assignDialogRef">
38+
<a11y-dialog
39+
id="app-dialog"
40+
app-root="#app"
41+
dialog-root="#dialog-root"
42+
@dialog-ref="assignDialogRef"
43+
>
3944
<h1 slot="title">Your dialog title</h1>
4045
<div>
4146
<p>Your content</p>
@@ -66,6 +71,19 @@ export default {
6671
}
6772
```
6873

74+
In your `index.html`, add a container where your dialog will be rendered into.
75+
76+
```html
77+
<!DOCTYPE html>
78+
<html>
79+
<body>
80+
<div id="app"></div>
81+
<!-- built files will be auto injected -->
82+
<div id="dialog-root"></div>
83+
</body>
84+
</html>
85+
```
86+
6987
It's important to assign the direct reference to the dialog instance via `@dialog-ref`, otherwise there is no way to call its methods.
7088

7189
Alternatively, you can also import the component directly into your file without installing it first:
@@ -114,7 +132,7 @@ export default {
114132
```
115133

116134
### `app-root`
117-
- **Property**: `appRoot`
135+
- **Property**: `app-root`
118136
- **Type**: `String`, `Array<String>` — CSS Selector string.
119137
- **Required**: `true`
120138
- **Description**: The selector(s) `a11y-dialog` needs to disable when the dialog is open.
@@ -125,6 +143,18 @@ export default {
125143
</a11y-dialog>
126144
```
127145

146+
### `dialog-root`
147+
- **Property**: `dialog-root`
148+
- **Type**: `String` — CSS Selector string.
149+
- **Required**: `true`
150+
- **Description**: The container for the dialog to be rendered into.
151+
- **Usage**:
152+
```html
153+
<a11y-dialog dialog-root="#dialog-root">
154+
<!-- ... -->
155+
</a11y-dialog>
156+
```
157+
128158
### `class-names`
129159
- **Property**: `class-names`
130160
- **Type**: `Object`
@@ -139,7 +169,7 @@ export default {
139169
```
140170

141171
### `title-id`
142-
- **Property**: `titleId`
172+
- **Property**: `title-id`
143173
- **Type**: `String`
144174
- **Required**: `false`
145175
- **Default**: Defaults to `id + '-title'`.
@@ -152,7 +182,7 @@ export default {
152182
```
153183

154184
### `close-button-label`
155-
- **Property**: `closeButtonLabel`
185+
- **Property**: `close-button-label`
156186
- **Type**: `String`
157187
- **Required**: `false`
158188
- **Default**: `'Close this dialog window'`

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.

0 commit comments

Comments
 (0)