@vaadin/a11y-base 24.1.5 → 24.2.0-alpha10

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/a11y-base",
3
- "version": "24.1.5",
3
+ "version": "24.2.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,13 +32,13 @@
32
32
  "dependencies": {
33
33
  "@open-wc/dedupe-mixin": "^1.3.0",
34
34
  "@polymer/polymer": "^3.0.0",
35
- "@vaadin/component-base": "~24.1.5",
35
+ "@vaadin/component-base": "24.2.0-alpha10",
36
36
  "lit": "^2.0.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@esm-bundle/chai": "^4.3.4",
40
- "@vaadin/testing-helpers": "^0.4.2",
40
+ "@vaadin/testing-helpers": "^0.5.0",
41
41
  "sinon": "^13.0.2"
42
42
  },
43
- "gitHead": "2150f0696b9205ed3651033301927516b87cf88f"
43
+ "gitHead": "ca16b5f88b00ae05fb6d7c7e9874525048e389f0"
44
44
  }
@@ -82,12 +82,9 @@ export const DelegateFocusMixin = dedupingMixin(
82
82
  * @override
83
83
  */
84
84
  focus() {
85
- if (!this.focusElement || this.disabled) {
86
- return;
85
+ if (this.focusElement && !this.disabled) {
86
+ this.focusElement.focus();
87
87
  }
88
-
89
- this.focusElement.focus();
90
- this._setFocused(true);
91
88
  }
92
89
 
93
90
  /**
@@ -95,11 +92,9 @@ export const DelegateFocusMixin = dedupingMixin(
95
92
  * @override
96
93
  */
97
94
  blur() {
98
- if (!this.focusElement) {
99
- return;
95
+ if (this.focusElement) {
96
+ this.focusElement.blur();
100
97
  }
101
- this.focusElement.blur();
102
- this._setFocused(false);
103
98
  }
104
99
 
105
100
  /**
package/src/list-mixin.js CHANGED
@@ -3,10 +3,11 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
7
6
  import { timeOut } from '@vaadin/component-base/src/async.js';
8
7
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
9
8
  import { getNormalizedScrollLeft, setNormalizedScrollLeft } from '@vaadin/component-base/src/dir-utils.js';
9
+ import { getFlattenedElements } from '@vaadin/component-base/src/dom-utils.js';
10
+ import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
10
11
  import { KeyboardDirectionMixin } from './keyboard-direction-mixin.js';
11
12
 
12
13
  /**
@@ -134,8 +135,9 @@ export const ListMixin = (superClass) =>
134
135
 
135
136
  this.addEventListener('click', (e) => this._onClick(e));
136
137
 
137
- this._observer = new FlattenedNodesObserver(this, () => {
138
- this._setItems(this._filterItems(FlattenedNodesObserver.getFlattenedNodes(this)));
138
+ const slot = this.shadowRoot.querySelector('slot:not([name])');
139
+ this._observer = new SlotObserver(slot, () => {
140
+ this._setItems(this._filterItems(getFlattenedElements(this)));
139
141
  });
140
142
  }
141
143
 
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const screenReaderOnly: CSSResult;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2023 Vaadin Ltd..
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+
7
+ /**
8
+ * @note Taken from Gaël Poupard gist
9
+ * @author Gaël Poupard
10
+ * @see https://gist.github.com/ffoodd/000b59f431e3e64e4ce1a24d5bb36034
11
+ */
12
+ import { css } from 'lit';
13
+
14
+ export const screenReaderOnly = css`
15
+ .sr-only {
16
+ border: 0 !important;
17
+ clip: rect(1px, 1px, 1px, 1px) !important;
18
+ -webkit-clip-path: inset(50%) !important;
19
+ clip-path: inset(50%) !important;
20
+ height: 1px !important;
21
+ margin: -1px !important;
22
+ overflow: hidden !important;
23
+ padding: 0 !important;
24
+ position: absolute !important;
25
+ width: 1px !important;
26
+ white-space: nowrap !important;
27
+ }
28
+ `;