@brightspace-ui/core 2.59.0 → 2.59.2

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.
@@ -3,7 +3,9 @@ import { css, html, LitElement } from 'lit';
3
3
  import { cssEscape, getComposedChildren, getComposedParent, isVisible } from '../../helpers/dom.js';
4
4
  import { getUniqueId } from '../../helpers/uniqueId.js';
5
5
 
6
- export const BACKDROP_ROLE = 'd2l-backdrop-role';
6
+ export const BACKDROP_ROLE = 'data-d2l-backdrop-role';
7
+ const BACKDROP_HIDDEN = 'data-d2l-backdrop-hidden';
8
+ const BACKDROP_ARIA_HIDDEN = 'data-d2l-backdrop-aria-hidden';
7
9
 
8
10
  const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
9
11
 
@@ -158,7 +160,7 @@ function hideAccessible(target) {
158
160
 
159
161
  if (child.tagName === 'SCRIPT' || child.tagName === 'STYLE') continue;
160
162
  if (path.indexOf(child) !== -1) continue;
161
- if (child.hasAttribute('d2l-backdrop-hidden')) continue;
163
+ if (child.hasAttribute(BACKDROP_HIDDEN)) continue;
162
164
 
163
165
  const role = child.getAttribute('role');
164
166
  if (role) child.setAttribute(BACKDROP_ROLE, role);
@@ -166,11 +168,11 @@ function hideAccessible(target) {
166
168
 
167
169
  if (child.nodeName === 'FORM' || child.nodeName === 'A') {
168
170
  const ariaHidden = child.getAttribute('aria-hidden');
169
- if (ariaHidden) child.setAttribute('d2l-backdrop-aria-hidden', ariaHidden);
171
+ if (ariaHidden) child.setAttribute(BACKDROP_ARIA_HIDDEN, ariaHidden);
170
172
  child.setAttribute('aria-hidden', 'true');
171
173
  }
172
174
 
173
- child.setAttribute('d2l-backdrop-hidden', 'd2l-backdrop-hidden');
175
+ child.setAttribute(BACKDROP_HIDDEN, BACKDROP_HIDDEN);
174
176
  hiddenElements.push(child);
175
177
 
176
178
  hideAccessibleChildren(child);
@@ -209,14 +211,16 @@ function showAccessible(elems) {
209
211
  } else {
210
212
  elem.removeAttribute('role');
211
213
  }
212
- const ariaHidden = elem.getAttribute('d2l-backdrop-aria-hidden');
213
- if (ariaHidden) {
214
- elem.setAttribute('aria-hidden', ariaHidden);
215
- elem.removeAttribute('d2l-backdrop-aria-hidden');
216
- } else {
217
- elem.removeAttribute('aria-hidden');
214
+ if (elem.nodeName === 'FORM' || elem.nodeName === 'A') {
215
+ const ariaHidden = elem.getAttribute(BACKDROP_ARIA_HIDDEN);
216
+ if (ariaHidden) {
217
+ elem.setAttribute('aria-hidden', ariaHidden);
218
+ elem.removeAttribute(BACKDROP_ARIA_HIDDEN);
219
+ } else {
220
+ elem.removeAttribute('aria-hidden');
221
+ }
218
222
  }
219
- elem.removeAttribute('d2l-backdrop-hidden');
223
+ elem.removeAttribute(BACKDROP_HIDDEN);
220
224
  }
221
225
  }
222
226
 
@@ -32,13 +32,14 @@ The `d2l-dialog` element is a generic dialog that provides a slot for arbitrary
32
32
  * Label primary actions with clear and predictable language. Use verbs like, “Add” or “Save” that indicate the outcome of a dialog rather than, “OK” or “Close”
33
33
  * Keep dialog titles concise
34
34
  * Maintain a language relationship between the action that triggered the dialog, dialog title, and dialog primary button.
35
+ * When it is necessary to stack multiple dialogs, ensure the stacked dialog is nested within the DOM of the dialog containing the opener
35
36
  <!-- docs: end dos -->
36
37
 
37
38
  <!-- docs: start donts -->
38
39
  * Don’t use a dialog when you could reasonably use an alternative that preserves user context, like expanding options inline
39
40
  * Don’t use a dialog to show error, success, or warning messages. Use an inline or toast alert instead.
40
41
  * Avoid creating large, complex dialogs
41
- * Avoid invoking a dialog from another dialog (nested dialogs)
42
+ * Avoid opening a dialog from within other dialogs (stacking dialogs)
42
43
  * Avoid a title length that could easily wrap to two lines
43
44
  <!-- docs: end donts -->
44
45
  <!-- docs: end best practices -->
@@ -25,9 +25,13 @@ export function announce(message) {
25
25
  /* Need to give browser enough time to create the live region so that it will
26
26
  treat the change as an update. Firefox sometimes ignores changes if the region
27
27
  and update are made too quickly in succession. RequestAnimationFrame is not
28
- sufficient here. */
28
+ sufficient here. Also, for some strange reason, sometimes VO will not announce
29
+ duplicate messages even if we remove the child so we also append a non-breaking space. */
29
30
  const elem = [...container.childNodes].find((c) => c.textContent === message);
30
- if (elem) elem.parentNode.removeChild(elem);
31
+ if (elem) {
32
+ elem.parentNode.removeChild(elem);
33
+ message = message.concat('\u00A0');
34
+ }
31
35
  setTimeout(() => {
32
36
  container.appendChild(document.createTextNode(message));
33
37
  }, 200);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.59.0",
3
+ "version": "2.59.2",
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",