@brightspace-ui/core 2.56.0 → 2.56.1

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.
@@ -407,14 +407,19 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
407
407
  if (!activeElement
408
408
  || !isComposedAncestor(dialog, activeElement)
409
409
  || !activeElement.classList.contains('focus-visible')) {
410
- this._focusInitial();
410
+ // wait till the dialog is visible for Safari
411
+ requestAnimationFrame(() => this._focusInitial());
411
412
  }
412
413
 
413
- if (!reduceMotion) await animPromise;
414
+ // if not animating, we need to wait a frame before dispatching due to focus rAF above
415
+ if (reduceMotion) await new Promise(resolve => requestAnimationFrame(resolve));
416
+ else await animPromise;
417
+
414
418
  /** Dispatched when the dialog is opened */
415
419
  this.dispatchEvent(new CustomEvent(
416
420
  'd2l-dialog-open', { bubbles: true, composed: true }
417
421
  ));
422
+
418
423
  }, 0);
419
424
 
420
425
  }
package/helpers/focus.js CHANGED
@@ -1,4 +1,4 @@
1
- import { findComposedAncestor, getComposedChildren, getComposedParent, getNextAncestorSibling, getPreviousAncestorSibling } from './dom.js';
1
+ import { findComposedAncestor, getComposedChildren, getComposedParent, getNextAncestorSibling, getPreviousAncestorSibling, isVisible } from './dom.js';
2
2
 
3
3
  const focusableElements = {
4
4
  a: true,
@@ -175,7 +175,7 @@ export function isFocusable(node, includeHidden, includeTabbablesOnly, includeDi
175
175
 
176
176
  if (_isFocusable && !includeHidden) {
177
177
  // only perform visibility check if absolutely necessary
178
- if (nodeName !== 'body' && node.offsetParent === null) return false;
178
+ if (nodeName !== 'body' && !isVisible(node)) return false;
179
179
  }
180
180
 
181
181
  return _isFocusable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.56.0",
3
+ "version": "2.56.1",
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",