@brightspace-ui/core 1.225.1 → 1.226.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -83,6 +83,12 @@ The `d2l-dialog` element is a generic dialog that provides a slot for arbitrary
|
|
|
83
83
|
- `d2l-dialog-close`: dispatched with the action value when the dialog is closed for any reason
|
|
84
84
|
<!-- docs: end hidden content -->
|
|
85
85
|
|
|
86
|
+
### Accessibility Properties
|
|
87
|
+
|
|
88
|
+
| Attribute | Description |
|
|
89
|
+
|--|--|
|
|
90
|
+
| `describe-content` | When set, screen readers will announce the contents when opened. |
|
|
91
|
+
|
|
86
92
|
### Methods
|
|
87
93
|
|
|
88
94
|
- `resize`: resizes the dialog based on specified `width` and measured content height
|
|
@@ -8,6 +8,7 @@ import { DialogMixin } from './dialog-mixin.js';
|
|
|
8
8
|
import { dialogStyles } from './dialog-styles.js';
|
|
9
9
|
import { getUniqueId } from '../../helpers/uniqueId.js';
|
|
10
10
|
import { heading3Styles } from '../typography/styles.js';
|
|
11
|
+
import { ifDefined } from 'lit-html/directives/if-defined.js';
|
|
11
12
|
import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
|
|
12
13
|
import { styleMap } from 'lit-html/directives/style-map.js';
|
|
13
14
|
|
|
@@ -27,6 +28,11 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
|
|
|
27
28
|
*/
|
|
28
29
|
async: { type: Boolean },
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Whether to read the contents of the dialog on open
|
|
33
|
+
*/
|
|
34
|
+
describeContent: { type: Boolean, attribute: 'describe-content' },
|
|
35
|
+
|
|
30
36
|
/**
|
|
31
37
|
* The preferred width (unit-less) for the dialog
|
|
32
38
|
*/
|
|
@@ -100,6 +106,7 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
|
|
|
100
106
|
constructor() {
|
|
101
107
|
super();
|
|
102
108
|
this.async = false;
|
|
109
|
+
this.describeContent = false;
|
|
103
110
|
this.width = 600;
|
|
104
111
|
this._handleResize = this._handleResize.bind(this);
|
|
105
112
|
this._handleResize();
|
|
@@ -151,9 +158,10 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
|
|
|
151
158
|
'd2l-footer-no-content': !this._hasFooterContent
|
|
152
159
|
};
|
|
153
160
|
|
|
161
|
+
if (!this._textId && this.describeContent) this._textId = getUniqueId();
|
|
154
162
|
const content = html`
|
|
155
163
|
${loading}
|
|
156
|
-
<div style=${styleMap(slotStyles)}><slot></slot></div>
|
|
164
|
+
<div id="${ifDefined(this._textId)}" style=${styleMap(slotStyles)}><slot></slot></div>
|
|
157
165
|
`;
|
|
158
166
|
|
|
159
167
|
if (!this._titleId) this._titleId = getUniqueId();
|
|
@@ -171,9 +179,11 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
|
|
|
171
179
|
</div>
|
|
172
180
|
</div>
|
|
173
181
|
`;
|
|
182
|
+
|
|
183
|
+
const descId = (this.describeContent) ? this._textId : undefined;
|
|
174
184
|
return this._render(
|
|
175
185
|
inner,
|
|
176
|
-
{ labelId: this._titleId, role: 'dialog' },
|
|
186
|
+
{ labelId: this._titleId, descId: descId, role: 'dialog' },
|
|
177
187
|
topOverride
|
|
178
188
|
);
|
|
179
189
|
}
|
package/custom-elements.json
CHANGED
|
@@ -1599,6 +1599,12 @@
|
|
|
1599
1599
|
"type": "boolean",
|
|
1600
1600
|
"default": "false"
|
|
1601
1601
|
},
|
|
1602
|
+
{
|
|
1603
|
+
"name": "describe-content",
|
|
1604
|
+
"description": "Whether to read the contents of the dialog on open",
|
|
1605
|
+
"type": "boolean",
|
|
1606
|
+
"default": "false"
|
|
1607
|
+
},
|
|
1602
1608
|
{
|
|
1603
1609
|
"name": "width",
|
|
1604
1610
|
"description": "The preferred width (unit-less) for the dialog",
|
|
@@ -1625,6 +1631,13 @@
|
|
|
1625
1631
|
"type": "boolean",
|
|
1626
1632
|
"default": "false"
|
|
1627
1633
|
},
|
|
1634
|
+
{
|
|
1635
|
+
"name": "describeContent",
|
|
1636
|
+
"attribute": "describe-content",
|
|
1637
|
+
"description": "Whether to read the contents of the dialog on open",
|
|
1638
|
+
"type": "boolean",
|
|
1639
|
+
"default": "false"
|
|
1640
|
+
},
|
|
1628
1641
|
{
|
|
1629
1642
|
"name": "width",
|
|
1630
1643
|
"attribute": "width",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.226.0",
|
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|