Skip to content

Commit 2bd05b6

Browse files
KittyGiraudelmorkro
authored andcommitted
Remove obsolete concept of dialog root
1 parent b4566fc commit 2bd05b6

File tree

3 files changed

+6
-37
lines changed

3 files changed

+6
-37
lines changed

README.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ Then use it as follows:
5050

5151
<a11y-dialog
5252
id="app-dialog"
53-
app-root="#app"
54-
dialog-root="#dialog-root"
5553
@dialog-ref="assignDialogRef"
5654
>
5755
<template v-slot:title>
@@ -95,7 +93,6 @@ In your `index.html`, add a container where your dialog will be rendered into.
9593
<body>
9694
<div id="app"></div>
9795
<!-- built files will be auto injected -->
98-
<div id="dialog-root"></div>
9996
</body>
10097
</html>
10198
```
@@ -131,8 +128,6 @@ In your `<template>`:
131128
<!-- First dialog -->
132129
<a11y-dialog
133130
id="first-dialog"
134-
app-root="#app"
135-
dialog-root="#dialog-root"
136131
@dialog-ref="dialog => assignDialogRef('first', dialog)"
137132
>
138133
<template v-slot:title>
@@ -146,8 +141,6 @@ In your `<template>`:
146141
<!-- Second dialog -->
147142
<a11y-dialog
148143
id="second-dialog"
149-
app-root="#app"
150-
dialog-root="#dialog-root"
151144
@dialog-ref="dialog => assignDialogRef('second', dialog)"
152145
>
153146
<template v-slot:title>
@@ -198,25 +191,12 @@ export default {
198191
</a11y-dialog>
199192
```
200193

201-
### `app-root`
202-
203-
- **Property**: `app-root`
204-
- **Type**: `String`, `Array<String>` — CSS Selector string.
205-
- **Required**: `true`
206-
- **Description**: The selector(s) `a11y-dialog` needs to disable when the dialog is open.
207-
- **Usage**:
208-
209-
```html
210-
<a11y-dialog app-root="#app">
211-
<!-- ... -->
212-
</a11y-dialog>
213-
```
214-
215194
### `dialog-root`
216195

217196
- **Property**: `dialog-root`
218197
- **Type**: `String` — CSS Selector string.
219-
- **Required**: `true`
198+
- **Required**: `false`
199+
- **Default**: `'body'`
220200
- **Description**: The container for the dialog to be rendered into.
221201
- **Usage**:
222202

src/A11yDialog.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,10 @@
5959
type: String,
6060
required: true,
6161
},
62-
appRoot: {
63-
type: String,
64-
required: true,
65-
},
6662
dialogRoot: {
6763
type: String,
68-
required: true,
64+
default: 'body',
65+
required: false,
6966
},
7067
/**
7168
* Object representing the classes for each HTML element of the dialog
@@ -116,7 +113,7 @@
116113
const rootElement = ref(null)
117114
118115
const portalTarget = computed(() => {
119-
return props.dialogRoot || props.appRoot
116+
return props.dialogRoot || 'body'
120117
})
121118
122119
const fullTitleId = computed(() => {
@@ -131,10 +128,7 @@
131128
132129
const instantiateDialog = async () => {
133130
await nextTick()
134-
dialog = new A11yDialog(
135-
rootElement.value,
136-
portalTarget.value || props.appRoot
137-
)
131+
dialog = new A11yDialog(rootElement.value)
138132
emit('dialog-ref', dialog)
139133
}
140134

src/Demo.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<template>
2-
<!-- Required to be here instead of index.html for Cypress -->
3-
<div id="dialog-root" />
4-
52
<header>
63
<h1>A11yDialog Demo</h1>
74
</header>
@@ -45,8 +42,6 @@
4542

4643
<a11y-dialog
4744
id="a11y-dialog"
48-
app-root="#app"
49-
dialog-root="#dialog-root"
5045
close-button-label="My close button label"
5146
:close-button-position="closePosition"
5247
title-id="uniqueTitleId"

0 commit comments

Comments
 (0)