@vaadin/field-highlighter 25.0.0-alpha6 → 25.0.0-alpha8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/field-highlighter",
3
- "version": "25.0.0-alpha6",
3
+ "version": "25.0.0-alpha8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,29 +33,29 @@
33
33
  "field"
34
34
  ],
35
35
  "dependencies": {
36
- "@vaadin/a11y-base": "25.0.0-alpha6",
37
- "@vaadin/component-base": "25.0.0-alpha6",
38
- "@vaadin/overlay": "25.0.0-alpha6",
39
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha6",
40
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha6",
36
+ "@vaadin/a11y-base": "25.0.0-alpha8",
37
+ "@vaadin/component-base": "25.0.0-alpha8",
38
+ "@vaadin/overlay": "25.0.0-alpha8",
39
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha8",
40
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha8",
41
41
  "lit": "^3.0.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@vaadin/chai-plugins": "25.0.0-alpha6",
45
- "@vaadin/checkbox": "25.0.0-alpha6",
46
- "@vaadin/checkbox-group": "25.0.0-alpha6",
47
- "@vaadin/date-picker": "25.0.0-alpha6",
48
- "@vaadin/date-time-picker": "25.0.0-alpha6",
49
- "@vaadin/item": "25.0.0-alpha6",
50
- "@vaadin/list-box": "25.0.0-alpha6",
51
- "@vaadin/radio-group": "25.0.0-alpha6",
52
- "@vaadin/select": "25.0.0-alpha6",
53
- "@vaadin/test-runner-commands": "25.0.0-alpha6",
44
+ "@vaadin/chai-plugins": "25.0.0-alpha8",
45
+ "@vaadin/checkbox": "25.0.0-alpha8",
46
+ "@vaadin/checkbox-group": "25.0.0-alpha8",
47
+ "@vaadin/date-picker": "25.0.0-alpha8",
48
+ "@vaadin/date-time-picker": "25.0.0-alpha8",
49
+ "@vaadin/item": "25.0.0-alpha8",
50
+ "@vaadin/list-box": "25.0.0-alpha8",
51
+ "@vaadin/radio-group": "25.0.0-alpha8",
52
+ "@vaadin/select": "25.0.0-alpha8",
53
+ "@vaadin/test-runner-commands": "25.0.0-alpha8",
54
54
  "@vaadin/testing-helpers": "^2.0.0",
55
- "@vaadin/text-area": "25.0.0-alpha6",
56
- "@vaadin/text-field": "25.0.0-alpha6",
57
- "@vaadin/time-picker": "25.0.0-alpha6",
55
+ "@vaadin/text-area": "25.0.0-alpha8",
56
+ "@vaadin/text-field": "25.0.0-alpha8",
57
+ "@vaadin/time-picker": "25.0.0-alpha8",
58
58
  "sinon": "^18.0.0"
59
59
  },
60
- "gitHead": "cd1d084198d2b326c58d44bb39fa4845b71ce551"
60
+ "gitHead": "ebf53673d5f639d2b1b6f2b31f640f530643ee2f"
61
61
  }
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
6
7
  import { ComponentObserver } from './vaadin-component-observer.js';
7
8
 
8
9
  export class DatePickerObserver extends ComponentObserver {
@@ -10,7 +11,6 @@ export class DatePickerObserver extends ComponentObserver {
10
11
  super(datePicker);
11
12
 
12
13
  this.datePicker = datePicker;
13
- this.fullscreenFocus = false;
14
14
  this.blurWhileOpened = false;
15
15
 
16
16
  this.addListeners(datePicker);
@@ -19,14 +19,6 @@ export class DatePickerObserver extends ComponentObserver {
19
19
  addListeners(datePicker) {
20
20
  this.overlay = datePicker.$.overlay;
21
21
 
22
- // Fullscreen date picker calls blur() to avoid focusing of the input:
23
- // 1. first time when focus event is fired (before opening the overlay),
24
- // 2. second time after the overlay is open, see "_onOverlayOpened".
25
- // Here we set the flag to ignore related focusout events and then to
26
- // mark date picker as being edited by user (to show field highlight).
27
- // We have to use capture phase in order to catch this event early.
28
- datePicker.addEventListener('blur', (event) => this.onBlur(event), true);
29
-
30
22
  datePicker.addEventListener('opened-changed', (event) => this.onOpenedChanged(event));
31
23
 
32
24
  this.overlay.addEventListener('focusout', (event) => this.onOverlayFocusOut(event));
@@ -40,14 +32,17 @@ export class DatePickerObserver extends ComponentObserver {
40
32
  return this.datePicker._overlayContent && this.datePicker._overlayContent.contains(node);
41
33
  }
42
34
 
43
- onBlur(event) {
35
+ isFullscreen() {
44
36
  const datePicker = this.datePicker;
45
- if (datePicker._fullscreen && !this.isEventInOverlay(event.relatedTarget)) {
46
- this.fullscreenFocus = true;
47
- }
37
+ return datePicker._noInput && !isKeyboardActive();
48
38
  }
49
39
 
50
40
  onFocusIn(event) {
41
+ if (this.isEventInOverlay(event.target)) {
42
+ // Focus moves to the overlay, do nothing.
43
+ return;
44
+ }
45
+
51
46
  if (this.isEventInOverlay(event.relatedTarget)) {
52
47
  // Focus returns from the overlay, do nothing.
53
48
  return;
@@ -63,9 +58,17 @@ export class DatePickerObserver extends ComponentObserver {
63
58
  }
64
59
 
65
60
  onFocusOut(event) {
66
- if (this.fullscreenFocus || this.isEventInOverlay(event.relatedTarget)) {
67
- // Do nothing, overlay is opening.
68
- } else if (!this.datePicker.opened) {
61
+ if (this.isEventInOverlay(event.target) && this.component.contains(event.relatedTarget)) {
62
+ // Focus returns from the overlay, do nothing.
63
+ return;
64
+ }
65
+
66
+ if (this.isEventInOverlay(event.relatedTarget)) {
67
+ // Focus moves to the overlay, do nothing.
68
+ return;
69
+ }
70
+
71
+ if (!this.datePicker.opened) {
69
72
  // Field blur when closed.
70
73
  this.hideOutline(this.datePicker);
71
74
  } else {
@@ -83,8 +86,7 @@ export class DatePickerObserver extends ComponentObserver {
83
86
  }
84
87
 
85
88
  onOpenedChanged(event) {
86
- if (event.detail.value === true && this.fullscreenFocus) {
87
- this.fullscreenFocus = false;
89
+ if (event.detail.value === true && this.isFullscreen()) {
88
90
  this.showOutline(this.datePicker);
89
91
  }
90
92
 
@@ -13,7 +13,12 @@ export class SelectObserver extends FieldObserver {
13
13
  }
14
14
 
15
15
  onFocusIn(event) {
16
- if (this.overlay.contains(event.relatedTarget)) {
16
+ if (this.overlay._contentRoot.contains(event.target)) {
17
+ // Focus moves to the overlay item, do nothing.
18
+ return;
19
+ }
20
+
21
+ if (this.overlay._contentRoot.contains(event.relatedTarget)) {
17
22
  // Focus returns on item select, do nothing.
18
23
  return;
19
24
  }
@@ -22,10 +27,16 @@ export class SelectObserver extends FieldObserver {
22
27
  }
23
28
 
24
29
  onFocusOut(event) {
25
- if (this.overlay.contains(event.relatedTarget)) {
26
- // Do nothing, overlay is opening.
30
+ if (this.overlay._contentRoot.contains(event.relatedTarget)) {
31
+ // Focus moves to the overlay on opening, do nothing.
27
32
  return;
28
33
  }
34
+
35
+ if (this.overlay._contentRoot.contains(event.target) && this.component.contains(event.relatedTarget)) {
36
+ // Focus returns from the overlay on closing, do nothing.
37
+ return;
38
+ }
39
+
29
40
  super.onFocusOut(event);
30
41
  }
31
42
  }
@@ -19,7 +19,7 @@ import { fieldOutlineStyles } from './styles/vaadin-field-outline-core-styles.js
19
19
  * @mixes ThemableMixin
20
20
  * @private
21
21
  */
22
- export class FieldOutline extends ThemableMixin(DirMixin(LumoInjectionMixin(PolylitMixin(LitElement)))) {
22
+ export class FieldOutline extends ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement)))) {
23
23
  static get is() {
24
24
  return 'vaadin-field-outline';
25
25
  }
@@ -20,7 +20,7 @@ import { userTagStyles } from './styles/vaadin-user-tag-core-styles.js';
20
20
  * @mixes ThemableMixin
21
21
  * @private
22
22
  */
23
- export class UserTag extends ThemableMixin(DirMixin(LumoInjectionMixin(PolylitMixin(LitElement)))) {
23
+ export class UserTag extends ThemableMixin(DirMixin(PolylitMixin(LumoInjectionMixin(LitElement)))) {
24
24
  static get is() {
25
25
  return 'vaadin-user-tag';
26
26
  }
@@ -25,7 +25,7 @@ import { userTagsOverlayStyles } from './styles/vaadin-user-tags-overlay-core-st
25
25
  * @private
26
26
  */
27
27
  class UserTagsOverlay extends PositionMixin(
28
- OverlayMixin(DirMixin(ThemableMixin(LumoInjectionMixin(PolylitMixin(LitElement))))),
28
+ OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))),
29
29
  ) {
30
30
  static get is() {
31
31
  return 'vaadin-user-tags-overlay';
@@ -38,7 +38,6 @@ class UserTagsOverlay extends PositionMixin(
38
38
  /** @protected */
39
39
  render() {
40
40
  return html`
41
- <div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
42
41
  <div part="overlay" id="overlay">
43
42
  <div part="content" id="content">
44
43
  <slot></slot>