@brightspace-ui/core 2.59.1 → 2.59.3

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
 
@@ -352,27 +352,35 @@ class InputNumber extends FocusMixin(LabelledMixin(SkeletonMixin(FormElementMixi
352
352
  updated(changedProperties) {
353
353
  super.updated(changedProperties);
354
354
 
355
+ let checkValidity = false;
355
356
  changedProperties.forEach((oldVal, prop) => {
356
357
  if (prop === 'value') {
357
358
  this.setFormValue(this.value);
358
-
359
- let rangeUnderflowCondition = false;
360
- if (typeof(this.min) === 'number') {
361
- rangeUnderflowCondition = this.minExclusive ? this.value <= this.min : this.value < this.min;
362
- }
363
-
364
- let rangeOverflowCondition = false;
365
- if (typeof(this.max) === 'number') {
366
- rangeOverflowCondition = this.maxExclusive ? this.value >= this.max : this.value > this.max;
367
- }
368
-
369
- this.setValidity({
370
- rangeUnderflow: rangeUnderflowCondition,
371
- rangeOverflow: rangeOverflowCondition
372
- });
373
- this.requestValidate(true);
359
+ checkValidity = true;
360
+ } else if ((prop === 'min' && oldVal !== undefined)
361
+ || (prop === 'max' && oldVal !== undefined)
362
+ || (prop === 'minExclusive' && oldVal !== undefined)
363
+ || (prop === 'maxExclusive' && oldVal !== undefined)) {
364
+ checkValidity = true;
374
365
  }
375
366
  });
367
+
368
+ if (checkValidity) {
369
+ let rangeUnderflowCondition = false;
370
+ if (typeof(this.min) === 'number') {
371
+ rangeUnderflowCondition = this.minExclusive ? this.value <= this.min : this.value < this.min;
372
+ }
373
+ let rangeOverflowCondition = false;
374
+ if (typeof(this.max) === 'number') {
375
+ rangeOverflowCondition = this.maxExclusive ? this.value >= this.max : this.value > this.max;
376
+ }
377
+
378
+ this.setValidity({
379
+ rangeUnderflow: rangeUnderflowCondition,
380
+ rangeOverflow: rangeOverflowCondition
381
+ });
382
+ this.requestValidate(true);
383
+ }
376
384
  }
377
385
 
378
386
  async validate() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.59.1",
3
+ "version": "2.59.3",
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",