@vaadin/popover 25.3.0-dev.1fa5a51482 → 25.3.0-rc1

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.
@@ -62,6 +62,20 @@
62
62
  "description": "A mixin providing common popover overlay functionality.",
63
63
  "name": "PopoverOverlayMixin",
64
64
  "members": [
65
+ {
66
+ "kind": "field",
67
+ "name": "autofocus",
68
+ "privacy": "public",
69
+ "type": {
70
+ "text": "boolean"
71
+ },
72
+ "description": "Set to true to move focus into the overlay automatically on open.\n\nFocus moves to the first tabbable element in the tab order. This\ncan be the overlay itself if it has `tabindex` attribute set to `0`\non the host element or the `overlay` shadow DOM part.",
73
+ "attribute": "autofocus",
74
+ "inheritedFrom": {
75
+ "name": "OverlayFocusMixin",
76
+ "package": "@vaadin/overlay/src/vaadin-overlay-focus-mixin.js"
77
+ }
78
+ },
65
79
  {
66
80
  "kind": "method",
67
81
  "name": "bringToFront",
@@ -94,7 +108,7 @@
94
108
  "type": {
95
109
  "text": "boolean"
96
110
  },
97
- "description": "When true, opening the overlay moves focus to the first focusable child,\nor to the overlay part with tabindex if there are no focusable children.",
111
+ "description": "Set to true to move focus into the overlay automatically on open\nand keep it inside: Tab and Shift+Tab cycle through the overlay's\ncontent until the overlay is closed.\n\nFocus moves to the first tabbable element in the tab order. This\ncan be the overlay itself if it has `tabindex` attribute set to `0`\non the host element or the `overlay` shadow DOM part.",
98
112
  "attribute": "focus-trap",
99
113
  "inheritedFrom": {
100
114
  "name": "OverlayFocusMixin",
@@ -355,12 +369,24 @@
355
369
  }
356
370
  ],
357
371
  "attributes": [
372
+ {
373
+ "name": "autofocus",
374
+ "type": {
375
+ "text": "boolean"
376
+ },
377
+ "description": "Set to true to move focus into the overlay automatically on open.\n\nFocus moves to the first tabbable element in the tab order. This\ncan be the overlay itself if it has `tabindex` attribute set to `0`\non the host element or the `overlay` shadow DOM part.",
378
+ "fieldName": "autofocus",
379
+ "inheritedFrom": {
380
+ "name": "OverlayFocusMixin",
381
+ "package": "@vaadin/overlay/src/vaadin-overlay-focus-mixin.js"
382
+ }
383
+ },
358
384
  {
359
385
  "name": "focus-trap",
360
386
  "type": {
361
387
  "text": "boolean"
362
388
  },
363
- "description": "When true, opening the overlay moves focus to the first focusable child,\nor to the overlay part with tabindex if there are no focusable children.",
389
+ "description": "Set to true to move focus into the overlay automatically on open\nand keep it inside: Tab and Shift+Tab cycle through the overlay's\ncontent until the overlay is closed.\n\nFocus moves to the first tabbable element in the tab order. This\ncan be the overlay itself if it has `tabindex` attribute set to `0`\non the host element or the `overlay` shadow DOM part.",
364
390
  "fieldName": "focusTrap",
365
391
  "inheritedFrom": {
366
392
  "name": "OverlayFocusMixin",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/popover",
3
- "version": "25.3.0-dev.1fa5a51482",
3
+ "version": "25.3.0-rc1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,19 +37,19 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@vaadin/a11y-base": "25.3.0-dev.1fa5a51482",
41
- "@vaadin/component-base": "25.3.0-dev.1fa5a51482",
42
- "@vaadin/lit-renderer": "25.3.0-dev.1fa5a51482",
43
- "@vaadin/overlay": "25.3.0-dev.1fa5a51482",
44
- "@vaadin/vaadin-themable-mixin": "25.3.0-dev.1fa5a51482",
40
+ "@vaadin/a11y-base": "25.3.0-rc1",
41
+ "@vaadin/component-base": "25.3.0-rc1",
42
+ "@vaadin/lit-renderer": "25.3.0-rc1",
43
+ "@vaadin/overlay": "25.3.0-rc1",
44
+ "@vaadin/vaadin-themable-mixin": "25.3.0-rc1",
45
45
  "lit": "^3.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@vaadin/aura": "25.3.0-dev.1fa5a51482",
49
- "@vaadin/chai-plugins": "25.3.0-dev.1fa5a51482",
50
- "@vaadin/test-runner-commands": "25.3.0-dev.1fa5a51482",
48
+ "@vaadin/aura": "25.3.0-rc1",
49
+ "@vaadin/chai-plugins": "25.3.0-rc1",
50
+ "@vaadin/test-runner-commands": "25.3.0-rc1",
51
51
  "@vaadin/testing-helpers": "^2.0.0",
52
- "@vaadin/vaadin-lumo-styles": "25.3.0-dev.1fa5a51482",
52
+ "@vaadin/vaadin-lumo-styles": "25.3.0-rc1",
53
53
  "sinon": "^22.0.0"
54
54
  },
55
55
  "customElements": "custom-elements.json",
@@ -57,5 +57,5 @@
57
57
  "web-types.json",
58
58
  "web-types.lit.json"
59
59
  ],
60
- "gitHead": "1cd5964b758ffbce3ddb6248a1997f55f8e0ebf6"
60
+ "gitHead": "d4809590b2f61bd607e376ab3dec84f4bfb059a7"
61
61
  }
@@ -56,6 +56,18 @@ export class PopoverFocusController {
56
56
  return;
57
57
  }
58
58
 
59
+ // Focus is on the popover itself: move into the content explicitly, so that
60
+ // the tab order does not depend on the browser's sequential focus navigation
61
+ // starting point (Firefox continues from the last clicked node).
62
+ if (!host.noTabFocus && isElementFocused(host)) {
63
+ const firstContent = getTabbableElements(host._overlayElement.$.content)[0];
64
+ if (firstContent) {
65
+ event.preventDefault();
66
+ firstContent.focus();
67
+ return;
68
+ }
69
+ }
70
+
59
71
  // Native Tab would land on the popover when DOM order places it right
60
72
  // after the current element. Skip past it via the logical list.
61
73
  const activeElement = getDeepActiveElement();
@@ -136,6 +148,11 @@ export class PopoverFocusController {
136
148
  if (event.key !== 'Tab') {
137
149
  return;
138
150
  }
151
+ // Another controller (e.g. the one of a parent popover) has already moved
152
+ // focus for this event, so this one must not move it a second time.
153
+ if (event.defaultPrevented) {
154
+ return;
155
+ }
139
156
  if (event.shiftKey) {
140
157
  this.__handleShiftTab(event);
141
158
  } else {
@@ -8,6 +8,7 @@ import { css, html, LitElement } from 'lit';
8
8
  import { ifDefined } from 'lit/directives/if-defined.js';
9
9
  import { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
10
10
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
11
+ import { setOrRemoveAttribute } from '@vaadin/component-base/src/dom-utils.js';
11
12
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
13
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
13
14
  import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
@@ -608,27 +609,15 @@ class Popover extends PopoverPositionMixin(
608
609
  }
609
610
 
610
611
  if (props.has('accessibleName')) {
611
- if (this.accessibleName) {
612
- this.setAttribute('aria-label', this.accessibleName);
613
- } else {
614
- this.removeAttribute('aria-label');
615
- }
612
+ setOrRemoveAttribute(this, 'aria-label', this.accessibleName);
616
613
  }
617
614
 
618
615
  if (props.has('accessibleNameRef')) {
619
- if (this.accessibleNameRef) {
620
- this.setAttribute('aria-labelledby', this.accessibleNameRef);
621
- } else {
622
- this.removeAttribute('aria-labelledby');
623
- }
616
+ setOrRemoveAttribute(this, 'aria-labelledby', this.accessibleNameRef);
624
617
  }
625
618
 
626
619
  if (props.has('modal')) {
627
- if (this.modal) {
628
- this.setAttribute('aria-modal', 'true');
629
- } else {
630
- this.removeAttribute('aria-modal');
631
- }
620
+ setOrRemoveAttribute(this, 'aria-modal', this.modal);
632
621
  }
633
622
  }
634
623
 
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/popover",
4
- "version": "25.3.0-dev.1fa5a51482",
4
+ "version": "25.3.0-rc1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/popover",
4
- "version": "25.3.0-dev.1fa5a51482",
4
+ "version": "25.3.0-rc1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {