@brightspace-ui/core 1.237.1 → 1.238.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.
@@ -176,12 +176,6 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
176
176
  min-width: calc(var(--d2l-vw, 1vw) * 100);
177
177
  top: 42px;
178
178
  }
179
-
180
- :host(:not([in-iframe])) dialog.d2l-dialog-outer,
181
- :host(:not([in-iframe])) div.d2l-dialog-outer {
182
- height: calc(var(--d2l-vh, 1vh) * 100 - 42px);
183
- min-height: calc(var(--d2l-vh, 1vh) * 100 - 42px);
184
- }
185
179
  }
186
180
  `];
187
181
  }
@@ -226,6 +220,9 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
226
220
  : 0;
227
221
  const startTop = mediaQueryList.matches ? 42 : 0;
228
222
  topOverride = iframeTop + startTop;
223
+ } else if (window.innerWidth <= 615 || (window.innerWidth <= 900 && window.innerHeight <= 420)) {
224
+ heightOverride.height = `${window.innerHeight - 42 - 2}px`; // render full window height - 42px top padding - 2px border
225
+ heightOverride.minHeight = heightOverride.height;
229
226
  }
230
227
 
231
228
  let loading = null;
@@ -99,7 +99,7 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
99
99
  z-index: 10; /* must be greater than adjacent selected items */
100
100
  }
101
101
  :host([_fullscreen-within]) {
102
- position: absolute; /* required for Safari */
102
+ position: fixed; /* required for Safari */
103
103
  z-index: 1000; /* must be greater than floating workflow buttons */
104
104
  }
105
105
  :host(:first-child) d2l-list-item-generic-layout[data-separators="between"] {
@@ -52,7 +52,7 @@
52
52
  <h2>Tooltip (error)</h2>
53
53
  <d2l-demo-snippet>
54
54
  <template>
55
- <d2l-input-text placeholder="Hover for Error" id="tooltip-error" aria-invalid="true"></d2l-input-text>
55
+ <d2l-input-text placeholder="Hover for Error" id="tooltip-error" aria-invalid="true" label="label"></d2l-input-text>
56
56
  <d2l-tooltip for="tooltip-error" state="error" align="start" offset="10">
57
57
  Your error message will display here
58
58
  </d2l-tooltip>
@@ -1,6 +1,6 @@
1
1
  import { clearDismissible, setDismissible } from '../../helpers/dismissible.js';
2
2
  import { css, html, LitElement } from 'lit-element/lit-element.js';
3
- import { cssEscape, getBoundingAncestor, getOffsetParent } from '../../helpers/dom.js';
3
+ import { cssEscape, elemIdListAdd, getBoundingAncestor, getOffsetParent } from '../../helpers/dom.js';
4
4
  import { announce } from '../../helpers/announce.js';
5
5
  import { bodySmallStyles } from '../typography/styles.js';
6
6
  import { getUniqueId } from '../../helpers/uniqueId.js';
@@ -844,9 +844,9 @@ class Tooltip extends RtlMixin(LitElement) {
844
844
  this.id = this.id || getUniqueId();
845
845
  this.setAttribute('role', 'tooltip');
846
846
  if (this.forType === 'label') {
847
- this._target.setAttribute('aria-labelledby', this.id);
847
+ elemIdListAdd(this._target, 'aria-labelledby', this.id);
848
848
  } else if (!this.announced || isInteractive) {
849
- this._target.setAttribute('aria-describedby', this.id);
849
+ elemIdListAdd(this._target, 'aria-describedby', this.id);
850
850
  }
851
851
  if (logAccessibilityWarning && !isInteractive && !this.announced) {
852
852
  console.warn(
package/helpers/README.md CHANGED
@@ -76,6 +76,12 @@ DOM helper functions to make your life easier.
76
76
  ```js
77
77
  import { ... } from '@brightspace-ui/core/helpers/dom.js';
78
78
 
79
+ // adds a value to an id-list attribute (e.g. aria-labelledby)
80
+ elemIdListAdd(node, attrName, value);
81
+
82
+ // removes a value from an id-list attribute (e.g. aria-labelledby)
83
+ elemIdListRemoves(node, attrName, value);
84
+
79
85
  // returns null or the closest ancestor that fulfills the specified predicate fxn
80
86
  findComposedAncestor(node, predicate);
81
87
 
package/helpers/dom.js CHANGED
@@ -7,6 +7,53 @@ export function cssEscape(val) {
7
7
  return val;
8
8
  }
9
9
 
10
+ export function elemIdListAdd(elem, attrName, value) {
11
+
12
+ if (elem === undefined || elem === null || !elem.getAttribute || !elem.setAttribute) {
13
+ throw new TypeError('elemIdListAdd: "elem" must be a valid DOM Element');
14
+ }
15
+ if (typeof(attrName) !== 'string') {
16
+ throw new TypeError('elemIdListAdd: "attrName" must be a valid string');
17
+ }
18
+ if (typeof(value) !== 'string') {
19
+ throw new TypeError('elemIdListAdd: "value" must be a valid ID string');
20
+ }
21
+
22
+ const parts = elem.hasAttribute(attrName) ? elem.getAttribute(attrName).split(' ') : [];
23
+ if (parts.indexOf(value) > -1) return;
24
+
25
+ parts.push(value);
26
+ elem.setAttribute(attrName, parts.join(' '));
27
+
28
+ }
29
+
30
+ export function elemIdListRemove(elem, attrName, value) {
31
+
32
+ if (elem === undefined || elem === null || !elem.getAttribute || !elem.setAttribute) {
33
+ throw new TypeError('elemIdListRemove: "elem" must be a valid DOM Element');
34
+ }
35
+ if (typeof(attrName) !== 'string') {
36
+ throw new TypeError('elemIdListRemove: "attrName" must be a valid string');
37
+ }
38
+ if (typeof(value) !== 'string') {
39
+ throw new TypeError('elemIdListRemove: "value" must be a valid ID string');
40
+ }
41
+
42
+ const existingValue = elem.getAttribute(attrName) || '';
43
+
44
+ const parts = existingValue.split(' ');
45
+ const index = parts.indexOf(value);
46
+ if (index === -1) return;
47
+
48
+ if (parts.length === 1) {
49
+ elem.removeAttribute(attrName);
50
+ } else {
51
+ parts.splice(index, 1);
52
+ elem.setAttribute(attrName, parts.join(' '));
53
+ }
54
+
55
+ }
56
+
10
57
  export function findComposedAncestor(node, predicate) {
11
58
  while (node) {
12
59
  if (predicate(node) === true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.237.1",
3
+ "version": "1.238.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",