@momentum-design/components 0.84.2 → 0.84.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.
@@ -1,10 +1,10 @@
1
+ export { default as AlertChip } from './alertchip';
1
2
  export { default as Animation } from './animation';
2
3
  export { default as Appheader } from './appheader';
3
- export { default as AlertChip } from './alertchip';
4
4
  export { default as Avatar } from './avatar';
5
5
  export { default as AvatarButton } from './avatarbutton';
6
- export { default as Badge } from './badge';
7
6
  export { default as Brandvisual } from './brandvisual';
7
+ export { default as Badge } from './badge';
8
8
  export { default as Bullet } from './bullet';
9
9
  export { default as Button } from './button';
10
10
  export { default as ButtonGroup } from './buttongroup';
@@ -32,9 +32,9 @@ export { default as List } from './list';
32
32
  export { default as ListItem } from './listitem';
33
33
  export { default as Marker } from './marker';
34
34
  export { default as MenuBar } from './menubar';
35
- export { default as MenuItem } from './menuitem';
36
- export { default as MenuItemCheckbox } from './menuitemcheckbox';
37
35
  export { default as MenuItemRadio } from './menuitemradio';
36
+ export { default as MenuItemCheckbox } from './menuitemcheckbox';
37
+ export { default as MenuItem } from './menuitem';
38
38
  export { default as MenuPopover } from './menupopover';
39
39
  export { default as MenuSection } from './menusection';
40
40
  export { default as NavItem } from './navitem';
@@ -1,10 +1,10 @@
1
+ export { default as AlertChip } from './alertchip';
1
2
  export { default as Animation } from './animation';
2
3
  export { default as Appheader } from './appheader';
3
- export { default as AlertChip } from './alertchip';
4
4
  export { default as Avatar } from './avatar';
5
5
  export { default as AvatarButton } from './avatarbutton';
6
- export { default as Badge } from './badge';
7
6
  export { default as Brandvisual } from './brandvisual';
7
+ export { default as Badge } from './badge';
8
8
  export { default as Bullet } from './bullet';
9
9
  export { default as Button } from './button';
10
10
  export { default as ButtonGroup } from './buttongroup';
@@ -32,9 +32,9 @@ export { default as List } from './list';
32
32
  export { default as ListItem } from './listitem';
33
33
  export { default as Marker } from './marker';
34
34
  export { default as MenuBar } from './menubar';
35
- export { default as MenuItem } from './menuitem';
36
- export { default as MenuItemCheckbox } from './menuitemcheckbox';
37
35
  export { default as MenuItemRadio } from './menuitemradio';
36
+ export { default as MenuItemCheckbox } from './menuitemcheckbox';
37
+ export { default as MenuItem } from './menuitem';
38
38
  export { default as MenuPopover } from './menupopover';
39
39
  export { default as MenuSection } from './menusection';
40
40
  export { default as NavItem } from './navitem';
@@ -16,6 +16,9 @@ import { property } from 'lit/decorators.js';
16
16
  *
17
17
  * This also makes sure there is only one keydown listener active at a time,
18
18
  * which is necessary to handle focus trapping correctly.
19
+ *
20
+ * Handling iFrames is supported, as long as there are focusable elements around the iFrame.
21
+ * Otherwise it will not work as expected.
19
22
  */
20
23
  class FocusTrapStack {
21
24
  static get stackArray() {
@@ -356,7 +359,7 @@ export const FocusTrapMixin = (superClass) => {
356
359
  * @param direction - The direction of the focus trap.
357
360
  * If true, the focus will be trapped in the previous element.
358
361
  */
359
- trapFocus(direction) {
362
+ trapFocus(event) {
360
363
  // calculate the focusable elements
361
364
  this.setFocusableElements();
362
365
  if (this.focusableElements.length === 0) {
@@ -364,6 +367,7 @@ export const FocusTrapMixin = (superClass) => {
364
367
  }
365
368
  const activeElement = this.getDeepActiveElement();
366
369
  const activeIndex = this.findElement(activeElement);
370
+ const direction = event.shiftKey;
367
371
  if (direction) {
368
372
  this.focusTrapIndex = this.calculateNextIndex(activeIndex, -1);
369
373
  }
@@ -371,8 +375,15 @@ export const FocusTrapMixin = (superClass) => {
371
375
  this.focusTrapIndex = this.calculateNextIndex(activeIndex, 1);
372
376
  }
373
377
  const nextElement = this.focusableElements[this.focusTrapIndex];
378
+ if (nextElement.tagName === 'IFRAME') {
379
+ // If the next element is an iframe we should not focus it manually
380
+ // but just let the browser handle it.
381
+ // this only works if there are focusable elements around the iframe!
382
+ return;
383
+ }
374
384
  if (nextElement) {
375
- nextElement.focus({ preventScroll: true });
385
+ event.preventDefault();
386
+ nextElement.focus();
376
387
  }
377
388
  }
378
389
  /**
@@ -386,8 +397,7 @@ export const FocusTrapMixin = (superClass) => {
386
397
  return;
387
398
  }
388
399
  if (event.key === 'Tab') {
389
- event.preventDefault();
390
- this.trapFocus(event.shiftKey);
400
+ this.trapFocus(event);
391
401
  }
392
402
  }
393
403
  }
package/package.json CHANGED
@@ -41,5 +41,5 @@
41
41
  "lottie-web": "^5.12.2",
42
42
  "uuid": "^11.0.5"
43
43
  },
44
- "version": "0.84.2"
44
+ "version": "0.84.3"
45
45
  }