@fluid-topics/ft-wc-utils 1.2.50 → 1.2.51
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/build/FtLitElement.d.ts +1 -1
- package/build/FtLitElement.js +5 -3
- package/build/a11y/FluidTopicsA11yEvents.d.ts +3 -0
- package/build/a11y/FluidTopicsA11yEvents.js +5 -0
- package/build/a11y/FluidTopicsA11yHints.d.ts +8 -0
- package/build/a11y/FluidTopicsA11yHints.js +15 -0
- package/build/globals.min.js +11 -11
- package/build/index.d.ts +5 -3
- package/build/index.js +12 -6
- package/build/redux/FtCommandQueue.d.ts +1 -0
- package/build/redux/FtCommandQueue.js +9 -1
- package/package.json +3 -3
package/build/FtLitElement.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare const dynamicDependenciesLoaded: unique symbol;
|
|
|
8
8
|
export type FtElementToFocus = {
|
|
9
9
|
element?: Optional<HTMLElement>;
|
|
10
10
|
selector?: string;
|
|
11
|
-
|
|
11
|
+
shadowPath?: string[];
|
|
12
12
|
};
|
|
13
13
|
export declare class FtLitElement extends ScopedRegistryLitElement {
|
|
14
14
|
exportpartsPrefix?: string;
|
package/build/FtLitElement.js
CHANGED
|
@@ -9,6 +9,7 @@ import { property, state } from "lit/decorators.js";
|
|
|
9
9
|
import { jsonProperty } from "./decorators";
|
|
10
10
|
import { Debouncer } from "./Debouncer";
|
|
11
11
|
import { ScopedRegistryLitElement } from "./ScopedRegistryLitElement";
|
|
12
|
+
import { shadowQuerySelector } from "./shadowQuerySelector";
|
|
12
13
|
const constructorPrototype = Symbol("constructorPrototype");
|
|
13
14
|
const constructorName = Symbol("constructorName");
|
|
14
15
|
const exportpartsDebouncer = Symbol("exportpartsDebouncer");
|
|
@@ -57,12 +58,13 @@ export class FtLitElement extends ScopedRegistryLitElement {
|
|
|
57
58
|
}
|
|
58
59
|
contentAvailableCallback(props) {
|
|
59
60
|
if (props.has("elementToFocus") && this.elementToFocus != null) {
|
|
60
|
-
let { element, selector,
|
|
61
|
+
let { element, selector, shadowPath } = this.elementToFocus;
|
|
61
62
|
if (selector != null) {
|
|
62
|
-
|
|
63
|
+
const selectors = [...shadowPath !== null && shadowPath !== void 0 ? shadowPath : [], selector];
|
|
64
|
+
element = shadowQuerySelector(this.shadowRoot, ...selectors);
|
|
63
65
|
}
|
|
64
66
|
element === null || element === void 0 ? void 0 : element.focus();
|
|
65
|
-
if (!isKeyboardNavigation) {
|
|
67
|
+
if (!window.FluidTopicsA11yHints.isKeyboardNavigation) {
|
|
66
68
|
element === null || element === void 0 ? void 0 : element.blur();
|
|
67
69
|
}
|
|
68
70
|
this.elementToFocus = undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
window.FluidTopicsA11yHints = {
|
|
2
|
+
isKeyboardNavigation: false,
|
|
3
|
+
};
|
|
4
|
+
function onKeyDown(event) {
|
|
5
|
+
if (event.key === "Enter" || event.key === " " || event.key === "Tab") {
|
|
6
|
+
window.FluidTopicsA11yHints.isKeyboardNavigation = true;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function onClick(event) {
|
|
10
|
+
// event.detail contains the number of clicks. If it is equal to 0, that means we are using a keyboard
|
|
11
|
+
window.FluidTopicsA11yHints.isKeyboardNavigation = event.detail == 0;
|
|
12
|
+
}
|
|
13
|
+
document.body.addEventListener("keydown", onKeyDown);
|
|
14
|
+
document.body.addEventListener("click", onClick);
|
|
15
|
+
export {};
|