Skip to content

Commit

Permalink
Merge pull request #293 from akashic-games/support-tabindex
Browse files Browse the repository at this point in the history
feat: add Platform#setTabindex()
  • Loading branch information
yu-ogi authored Oct 17, 2023
2 parents 5c31da8 + 7267b7b commit 1bcaeff
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 2.8.1
* `Platform#setTabindex()` を追加
* `InputHandler``view` の Element に `tabindex: 0` をデフォルトで付与するように
* これはバージョン 2.4.3 以前の挙動と同様となります。

## 2.8.0
* @akashic/pdi-types@1.12.0 に追従
* `PointerEvent` サポート環境において `PointMoveEvent#button`, `PointUpEvent#button` に対応
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions src/ContainerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export class ContainerController {
}
}

setTabindex(tabindex: string): void {
this.inputHandlerLayer.setViewTabindex(tabindex);
}

private _loadView(): void {
const { primarySurfaceWidth: width, primarySurfaceHeight: height } = this._rendererReq;
// DocumentFragmentはinsertした時点で開放されているため毎回作る
Expand Down
6 changes: 6 additions & 0 deletions src/InputHandlerLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,17 @@ export class InputHandlerLayer {
view.style.height = size.height + "px";
}

setViewTabindex(tabindex: string): void {
const view = this.view;
view.setAttribute("tabindex", tabindex);
}

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;
}
}
4 changes: 4 additions & 0 deletions src/Platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ export class Platform implements pdi.Platform {
return this._audioManager.getMasterVolume();
}

setTabindex(tabindex: string): void {
this.containerController.setTabindex(tabindex);
}

destroy(): void {
this.setRendererRequirement(undefined);
this.setMasterVolume(0);
Expand Down

0 comments on commit 1bcaeff

Please sign in to comment.