From aac63d2436867fba174e2bf93bade9ab9acb19e1 Mon Sep 17 00:00:00 2001 From: yu-ogi Date: Fri, 13 Oct 2023 14:33:30 +0900 Subject: [PATCH 1/4] feat: add Platform#setTabindex() --- CHANGELOG.md | 5 +++++ src/ContainerController.ts | 4 ++++ src/InputHandlerLayer.ts | 6 ++++++ src/Platform.ts | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f374fa..c9a9915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## unreleased changes +* `Platform#setTabindex()` を追加 +* `InputHandler` の `view` の Element に `tabindex: 0` をデフォルトで付与するように + * これはバージョン 2.4.3 以前の挙動と同様となります。 + ## 2.8.0 * @akashic/pdi-types@1.12.0 に追従 * `PointerEvent` サポート環境において `PointMoveEvent#button`, `PointUpEvent#button` に対応 diff --git a/src/ContainerController.ts b/src/ContainerController.ts index ee30d41..f36e305 100644 --- a/src/ContainerController.ts +++ b/src/ContainerController.ts @@ -99,6 +99,10 @@ export class ContainerController { } } + setTabindex(index: number | undefined): void { + this.inputHandlerLayer.setViewTabindex(index); + } + private _loadView(): void { const { primarySurfaceWidth: width, primarySurfaceHeight: height } = this._rendererReq; // DocumentFragmentはinsertした時点で開放されているため毎回作る diff --git a/src/InputHandlerLayer.ts b/src/InputHandlerLayer.ts index 74690f7..9611628 100644 --- a/src/InputHandlerLayer.ts +++ b/src/InputHandlerLayer.ts @@ -67,11 +67,17 @@ export class InputHandlerLayer { view.style.height = size.height + "px"; } + setViewTabindex(tabindex: number | undefined): void { + const view = this.view; + view.setAttribute("tabindex", tabindex == null ? "" : tabindex.toString()); + } + private _createInputView(width: number, height: number): HTMLDivElement { const view = document.createElement("div"); view.setAttribute("style", "display:inline-block; outline:none;"); view.style.width = width + "px"; view.style.height = height + "px"; + view.setAttribute("tabindex", "0"); return view; } } diff --git a/src/Platform.ts b/src/Platform.ts index ab887d6..f51980b 100644 --- a/src/Platform.ts +++ b/src/Platform.ts @@ -181,6 +181,10 @@ export class Platform implements pdi.Platform { return this._audioManager.getMasterVolume(); } + setTabindex(tabindex: number | undefined): void { + this.containerController.setTabindex(tabindex); + } + destroy(): void { this.setRendererRequirement(undefined); this.setMasterVolume(0); From 3e489d8d221434c905062b11eecfb4f21ce80a3d Mon Sep 17 00:00:00 2001 From: yu-ogi Date: Tue, 17 Oct 2023 14:41:32 +0900 Subject: [PATCH 2/4] fix: replace tabindex to string --- src/ContainerController.ts | 4 ++-- src/InputHandlerLayer.ts | 4 ++-- src/Platform.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ContainerController.ts b/src/ContainerController.ts index f36e305..22b9550 100644 --- a/src/ContainerController.ts +++ b/src/ContainerController.ts @@ -99,8 +99,8 @@ export class ContainerController { } } - setTabindex(index: number | undefined): void { - this.inputHandlerLayer.setViewTabindex(index); + setTabindex(tabindex: string): void { + this.inputHandlerLayer.setViewTabindex(tabindex); } private _loadView(): void { diff --git a/src/InputHandlerLayer.ts b/src/InputHandlerLayer.ts index 9611628..2708017 100644 --- a/src/InputHandlerLayer.ts +++ b/src/InputHandlerLayer.ts @@ -67,9 +67,9 @@ export class InputHandlerLayer { view.style.height = size.height + "px"; } - setViewTabindex(tabindex: number | undefined): void { + setViewTabindex(tabindex: string): void { const view = this.view; - view.setAttribute("tabindex", tabindex == null ? "" : tabindex.toString()); + view.setAttribute("tabindex", tabindex); } private _createInputView(width: number, height: number): HTMLDivElement { diff --git a/src/Platform.ts b/src/Platform.ts index f51980b..99ed05b 100644 --- a/src/Platform.ts +++ b/src/Platform.ts @@ -181,7 +181,7 @@ export class Platform implements pdi.Platform { return this._audioManager.getMasterVolume(); } - setTabindex(tabindex: number | undefined): void { + setTabindex(tabindex: string): void { this.containerController.setTabindex(tabindex); } From b63fb93824092fac4c0d0a6ac4c0e111b74dda3a Mon Sep 17 00:00:00 2001 From: yu-ogi Date: Tue, 17 Oct 2023 16:37:56 +0900 Subject: [PATCH 3/4] chore: v2.8.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6cb96a0..d991e6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@akashic/pdi-browser", - "version": "2.8.0", + "version": "2.8.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@akashic/pdi-browser", - "version": "2.8.0", + "version": "2.8.1", "license": "MIT", "dependencies": { "@akashic/trigger": "^2.0.1" diff --git a/package.json b/package.json index 45226cb..c89f983 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@akashic/pdi-browser", - "version": "2.8.0", + "version": "2.8.1", "description": "An akashic-pdi implementation for Web browsers", "main": "index.js", "typings": "lib/full/index.d.ts", From 7267b7b9e7cb95d7ff1c858e2875f32e478efd7b Mon Sep 17 00:00:00 2001 From: yu-ogi Date: Tue, 17 Oct 2023 16:38:32 +0900 Subject: [PATCH 4/4] chore: update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9a9915..0d8facd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## unreleased changes +## 2.8.1 * `Platform#setTabindex()` を追加 * `InputHandler` の `view` の Element に `tabindex: 0` をデフォルトで付与するように * これはバージョン 2.4.3 以前の挙動と同様となります。