@brightspace-ui/core 2.186.5 → 2.187.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.
@@ -34,6 +34,16 @@ class FocusTrap extends FocusMixin(LitElement) {
34
34
  `;
35
35
  }
36
36
 
37
+ static #exemptSelectors = [
38
+ '.d2l-focus-trap-exempt',
39
+ '.equatio-toolbar-wrapper',
40
+ '.equatio-toolbar-shadow-root-container'
41
+ ].join(', ');
42
+
43
+ static #isExempt(target) {
44
+ return !!target?.closest(this.#exemptSelectors);
45
+ }
46
+
37
47
  constructor() {
38
48
  super();
39
49
  this.trap = false;
@@ -97,13 +107,13 @@ class FocusTrap extends FocusMixin(LitElement) {
97
107
  if (!this.trap || this._legacyPromptIds.size > 0 || lastTrap !== this) return;
98
108
  const container = this._getContainer();
99
109
  const target = e.composedPath()[0];
100
- if (isComposedAncestor(container, target)) return;
110
+ if (isComposedAncestor(container, target) || FocusTrap.#isExempt(target)) return;
101
111
  this._focusFirst();
102
112
  }
103
113
 
104
114
  _handleEndFocusIn(e) {
105
115
  const container = this._getContainer();
106
- if (this.shadowRoot && isComposedAncestor(container, e.relatedTarget)) {
116
+ if (this.shadowRoot && (isComposedAncestor(container, e.relatedTarget) || FocusTrap.#isExempt(e.relatedTarget))) {
107
117
  // user is exiting trap via forward tabbing...
108
118
  const firstFocusable = getNextFocusable(this.shadowRoot.querySelector('.d2l-focus-trap-start'));
109
119
  if (firstFocusable) {
@@ -127,7 +137,7 @@ class FocusTrap extends FocusMixin(LitElement) {
127
137
 
128
138
  _handleStartFocusIn(e) {
129
139
  const container = this._getContainer();
130
- if (this.shadowRoot && isComposedAncestor(container, e.relatedTarget)) {
140
+ if (this.shadowRoot && (isComposedAncestor(container, e.relatedTarget) || FocusTrap.#isExempt(e.relatedTarget))) {
131
141
  // user is exiting trap via back tabbing...
132
142
  const lastFocusable = getPreviousFocusable(this.shadowRoot.querySelector('.d2l-focus-trap-end'));
133
143
  if (lastFocusable) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.186.5",
3
+ "version": "2.187.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",