@brightspace-ui/core 2.159.1 → 2.159.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.
@@ -4,6 +4,8 @@ import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
4
4
  import { ifDefined } from 'lit/directives/if-defined.js';
5
5
  import { isComposedAncestor } from '../../helpers/dom.js';
6
6
 
7
+ const traps = [];
8
+
7
9
  /**
8
10
  * A generic container component to trap user focus.
9
11
  * @fires d2l-focus-trap-enter - Dispatched when focus enters the trap. May be used to override initial focus placement when focus enters the trap.
@@ -68,6 +70,17 @@ class FocusTrap extends FocusMixin(LitElement) {
68
70
  `;
69
71
  }
70
72
 
73
+ willUpdate(changedProperties) {
74
+ if (!changedProperties.has('trap')) return;
75
+ if (this.trap) {
76
+ traps.push(this);
77
+ } else {
78
+ const trapIndex = traps.findIndex(trap => trap === this);
79
+ if (trapIndex === -1) return;
80
+ traps.splice(trapIndex, 1);
81
+ }
82
+ }
83
+
71
84
  _focusFirst() {
72
85
  const focusable = this.shadowRoot &&
73
86
  getNextFocusable(this.shadowRoot.querySelector('.d2l-focus-trap-start'));
@@ -80,7 +93,8 @@ class FocusTrap extends FocusMixin(LitElement) {
80
93
  }
81
94
 
82
95
  _handleBodyFocus(e) {
83
- if (!this.trap || this._legacyPromptIds.size > 0) return;
96
+ const lastTrap = traps[traps.length - 1];
97
+ if (!this.trap || this._legacyPromptIds.size > 0 || lastTrap !== this) return;
84
98
  const container = this._getContainer();
85
99
  const target = e.composedPath()[0];
86
100
  if (isComposedAncestor(container, target)) return;
@@ -6,6 +6,7 @@ import { FormMixin } from './form-mixin.js';
6
6
  * A component that can be used to build sections containing interactive controls that are validated and submitted as a group.
7
7
  * Values of these interactive controls are aggregated but the user is responsible for handling submission via the @d2l-form-submit event.
8
8
  * @slot - The native and custom form elements that participate in validation and submission
9
+ * @fires d2l-form-connect - Internal event
9
10
  */
10
11
  class Form extends FormMixin(LitElement) {
11
12
 
@@ -4342,7 +4342,8 @@
4342
4342
  ],
4343
4343
  "events": [
4344
4344
  {
4345
- "name": "d2l-form-connect"
4345
+ "name": "d2l-form-connect",
4346
+ "description": "Internal event"
4346
4347
  },
4347
4348
  {
4348
4349
  "name": "d2l-form-invalid",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.159.1",
3
+ "version": "2.159.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",