@brightspace-ui/core 2.71.4 → 2.71.6

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,6 @@ 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 = 'data-d2l-backdrop-role';
7
6
  const BACKDROP_HIDDEN = 'data-d2l-backdrop-hidden';
8
7
  const BACKDROP_ARIA_HIDDEN = 'data-d2l-backdrop-aria-hidden';
9
8
 
@@ -68,7 +67,8 @@ class Backdrop extends LitElement {
68
67
  transition: none;
69
68
  }
70
69
  @media (prefers-reduced-motion: reduce) {
71
- :host {
70
+ :host,
71
+ :host([slow-transition]) {
72
72
  transition: none;
73
73
  }
74
74
  }
@@ -162,20 +162,13 @@ function hideAccessible(target) {
162
162
  if (path.indexOf(child) !== -1) continue;
163
163
  if (child.hasAttribute(BACKDROP_HIDDEN)) continue;
164
164
 
165
- const role = child.getAttribute('role');
166
- if (role) child.setAttribute(BACKDROP_ROLE, role);
167
- child.setAttribute('role', 'presentation');
168
-
169
- if (child.nodeName === 'FORM' || child.nodeName === 'A') {
170
- const ariaHidden = child.getAttribute('aria-hidden');
171
- if (ariaHidden) child.setAttribute(BACKDROP_ARIA_HIDDEN, ariaHidden);
172
- child.setAttribute('aria-hidden', 'true');
165
+ if (child.hasAttribute('aria-hidden')) {
166
+ child.setAttribute(BACKDROP_ARIA_HIDDEN, child.getAttribute('aria-hidden'));
173
167
  }
168
+ child.setAttribute('aria-hidden', 'true');
174
169
 
175
170
  child.setAttribute(BACKDROP_HIDDEN, BACKDROP_HIDDEN);
176
171
  hiddenElements.push(child);
177
-
178
- hideAccessibleChildren(child);
179
172
  }
180
173
  };
181
174
 
@@ -204,21 +197,11 @@ export function preventBodyScroll() {
204
197
  function showAccessible(elems) {
205
198
  for (let i = 0; i < elems.length; i++) {
206
199
  const elem = elems[i];
207
- const role = elem.getAttribute(BACKDROP_ROLE);
208
- if (role) {
209
- elem.setAttribute('role', role);
210
- elem.removeAttribute(BACKDROP_ROLE);
200
+ if (elem.hasAttribute(BACKDROP_ARIA_HIDDEN)) {
201
+ elem.setAttribute('aria-hidden', elem.getAttribute(BACKDROP_ARIA_HIDDEN));
202
+ elem.removeAttribute(BACKDROP_ARIA_HIDDEN);
211
203
  } else {
212
- elem.removeAttribute('role');
213
- }
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
- }
204
+ elem.removeAttribute('aria-hidden');
222
205
  }
223
206
  elem.removeAttribute(BACKDROP_HIDDEN);
224
207
  }
@@ -203,7 +203,8 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
203
203
  if (!this.shadowRoot) return;
204
204
  const content = this.shadowRoot.querySelector('.d2l-dialog-content');
205
205
  if (content) {
206
- const elementToFocus = this._findAutofocusElement(content) ?? getNextFocusable(content);
206
+ const autofocusElem = this._findAutofocusElement(content);
207
+ const elementToFocus = autofocusElem ? autofocusElem : getNextFocusable(content);
207
208
  if (isComposedAncestor(this.shadowRoot.querySelector('.d2l-dialog-inner'), elementToFocus)) {
208
209
  forceFocusVisible(elementToFocus, false);
209
210
  return;
@@ -34,7 +34,7 @@ export const SelectionObserverMixin = superclass => class extends superclass {
34
34
  requestAnimationFrame(() => {
35
35
  if (this.selectionFor) {
36
36
  this._handleSelectionFor();
37
- return this._provider?.subscribeObserver(this);
37
+ return this._provider ? this._provider.subscribeObserver(this) : undefined;
38
38
  }
39
39
 
40
40
  const evt = new CustomEvent('d2l-selection-observer-subscribe', {
@@ -130,7 +130,7 @@ export const LocalizeMixin = dedupeMixin(superclass => class extends superclass
130
130
 
131
131
  static _generatePossibleLanguages(config) {
132
132
 
133
- if (config?.useBrowserLangs) return navigator.languages.map(e => e.toLowerCase()).concat('en');
133
+ if (config && config.useBrowserLangs) return navigator.languages.map(e => e.toLowerCase()).concat('en');
134
134
 
135
135
  const { language, fallbackLanguage } = this.documentLocaleSettings;
136
136
  const langs = [ language, fallbackLanguage ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.71.4",
3
+ "version": "2.71.6",
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",
@@ -921,7 +921,7 @@ class TemplatePrimarySecondary extends FocusVisiblePolyfillMixin(RtlMixin(Locali
921
921
 
922
922
  render() {
923
923
  let tabindex;
924
- const size = this._size ?? 0;
924
+ const size = this._size ? this._size : 0;
925
925
  const secondaryPanelStyles = {};
926
926
  if (this._isResizable()) {
927
927
  secondaryPanelStyles[this._isMobile ? 'height' : 'width'] = `${size}px`;