@brightspace-ui/core 3.148.0 → 3.148.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.
@@ -254,7 +254,7 @@ class DialogFullscreen extends PropertyRequiredMixin(LocalizeCoreElement(AsyncCo
|
|
254
254
|
|
255
255
|
const content = html`
|
256
256
|
${loading}
|
257
|
-
<div style=${styleMap(slotStyles)}><slot></slot></div>
|
257
|
+
<div style=${styleMap(slotStyles)}><slot @slotchange="${this._handleSlotChange}"></slot></div>
|
258
258
|
`;
|
259
259
|
|
260
260
|
const contentTabIndex = !this.focusableContentElemPresent ? '0' : undefined;
|
@@ -312,6 +312,10 @@ class DialogFullscreen extends PropertyRequiredMixin(LocalizeCoreElement(AsyncCo
|
|
312
312
|
this._headerStyle = mediaQueryList.matches ? 'd2l-heading-3' : 'd2l-heading-2';
|
313
313
|
}
|
314
314
|
|
315
|
+
_handleSlotChange() {
|
316
|
+
requestAnimationFrame(() => this._updateFocusableContentElemPresent());
|
317
|
+
}
|
318
|
+
|
315
319
|
}
|
316
320
|
|
317
321
|
customElements.define('d2l-dialog-fullscreen', DialogFullscreen);
|
@@ -227,16 +227,10 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
227
227
|
|
228
228
|
_focusFirst() {
|
229
229
|
if (!this.shadowRoot) return;
|
230
|
-
const
|
231
|
-
if (
|
232
|
-
|
233
|
-
|
234
|
-
this.focusableContentElemPresent = true;
|
235
|
-
}
|
236
|
-
if (isComposedAncestor(this.shadowRoot.querySelector('.d2l-dialog-inner'), elementToFocus)) {
|
237
|
-
this._focusElemOrDescendant(elementToFocus);
|
238
|
-
return;
|
239
|
-
}
|
230
|
+
const elementToFocus = this._updateFocusableContentElemPresent();
|
231
|
+
if (elementToFocus && isComposedAncestor(this.shadowRoot.querySelector('.d2l-dialog-inner'), elementToFocus)) {
|
232
|
+
this._focusElemOrDescendant(elementToFocus);
|
233
|
+
return;
|
240
234
|
}
|
241
235
|
const focusTrap = this.shadowRoot.querySelector('d2l-focus-trap');
|
242
236
|
if (focusTrap) {
|
@@ -454,6 +448,9 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
454
448
|
if (reduceMotion) await new Promise(resolve => requestAnimationFrame(resolve));
|
455
449
|
else await animPromise;
|
456
450
|
|
451
|
+
// check if focusable content is present in order to set focusableContentElemPresent to true
|
452
|
+
requestAnimationFrame(() => this._updateFocusableContentElemPresent());
|
453
|
+
|
457
454
|
await this.waitForUpdateComplete();
|
458
455
|
await this._updateSize();
|
459
456
|
/** Dispatched when the dialog is opened */
|
@@ -544,6 +541,17 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
|
|
544
541
|
if (isFocusable(focusable)) focusable.focus();
|
545
542
|
}
|
546
543
|
|
544
|
+
_updateFocusableContentElemPresent() {
|
545
|
+
const content = this.shadowRoot?.querySelector('.d2l-dialog-content');
|
546
|
+
if (!content) return null;
|
547
|
+
|
548
|
+
const elementToFocus = this._findAutofocusElement(content) ?? getNextFocusable(content);
|
549
|
+
if (isComposedAncestor(content, elementToFocus)) {
|
550
|
+
this.focusableContentElemPresent = true;
|
551
|
+
}
|
552
|
+
return elementToFocus;
|
553
|
+
}
|
554
|
+
|
547
555
|
_updateOverflow() {
|
548
556
|
if (!this.shadowRoot) return;
|
549
557
|
const content = this.shadowRoot.querySelector('.d2l-dialog-content');
|
@@ -167,7 +167,7 @@ class Dialog extends PropertyRequiredMixin(LocalizeCoreElement(AsyncContainerMix
|
|
167
167
|
|
168
168
|
const content = html`
|
169
169
|
${loading}
|
170
|
-
<div id="${ifDefined(this._textId)}" style=${styleMap(slotStyles)}><slot></slot></div>
|
170
|
+
<div id="${ifDefined(this._textId)}" style=${styleMap(slotStyles)}><slot @slotchange="${this._handleSlotChange}"></slot></div>
|
171
171
|
`;
|
172
172
|
|
173
173
|
const contentTabIndex = !this.focusableContentElemPresent ? '0' : undefined;
|
@@ -223,6 +223,10 @@ class Dialog extends PropertyRequiredMixin(LocalizeCoreElement(AsyncContainerMix
|
|
223
223
|
this.resize();
|
224
224
|
}
|
225
225
|
|
226
|
+
_handleSlotChange() {
|
227
|
+
requestAnimationFrame(() => this._updateFocusableContentElemPresent());
|
228
|
+
}
|
229
|
+
|
226
230
|
}
|
227
231
|
|
228
232
|
customElements.define('d2l-dialog', Dialog);
|
@@ -59,15 +59,14 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(super
|
|
59
59
|
padding: 0.1rem;
|
60
60
|
vertical-align: middle;
|
61
61
|
}
|
62
|
-
${getFocusRingStyles('.d2l-switch-container')}
|
62
|
+
${getFocusRingStyles('.d2l-switch-container', { extraStyles: css`position: relative;` })}
|
63
63
|
:host([disabled]) .d2l-switch-container {
|
64
64
|
cursor: default;
|
65
65
|
opacity: 0.5;
|
66
66
|
}
|
67
67
|
:host([disabled]) .d2l-switch-container:hover > .d2l-switch-inner,
|
68
68
|
:host([disabled]) .d2l-switch-inner:hover {
|
69
|
-
|
70
|
-
box-shadow: none;
|
69
|
+
outline: none;
|
71
70
|
}
|
72
71
|
.d2l-switch-inner {
|
73
72
|
background-color: var(--d2l-color-regolith);
|
@@ -150,7 +149,6 @@ export const SwitchMixin = superclass => class extends FocusMixin(RtlMixin(super
|
|
150
149
|
display: none;
|
151
150
|
}
|
152
151
|
.d2l-switch-inner:hover, .switch-hover {
|
153
|
-
border-color: transparent;
|
154
152
|
outline: 2px solid var(--d2l-color-celestine);
|
155
153
|
outline-offset: -2px;
|
156
154
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.148.
|
3
|
+
"version": "3.148.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",
|