Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust KeyMap for Android #652

Merged
merged 5 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed
- Dpad keymap for Android devices

## [3.73.0] - 2024-09-06

### Added
Expand Down
2 changes: 1 addition & 1 deletion spec/spatialnavigation/keymap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('getKeyMapForPlatform', () => {
${userAgent.chrome} | ${27}
${userAgent.playStation5} | ${27}
${userAgent.hisense} | ${8}
${userAgent.android} | ${4}
${userAgent.android} | ${27}
`('should return a key map with [$expectedBackKey]=Actions.BACK', ({ userAgent, expectedBackKey }) => {
const userAgentSpy = jest.spyOn(window.navigator, 'userAgent', 'get').mockReturnValue(userAgent);
const keyMap = getKeyMapForPlatform();
Expand Down
16 changes: 7 additions & 9 deletions src/ts/spatialnavigation/keymap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,17 @@ const AndroidKeyMap = {
isApplicable: () => BrowserUtils.isAndroid,
keyCodes: {
// D-pad Up
19: Direction.UP,
38: Direction.UP,
// D-pad Down
20: Direction.DOWN,
40: Direction.DOWN,
// D-pad Left
21: Direction.LEFT,
37: Direction.LEFT,
// D-pad Right
22: Direction.RIGHT,
// D-pad Center
23: Action.SELECT,
// Enter
66: Action.SELECT,
39: Direction.RIGHT,
// D-pad OK
13: Action.SELECT,
// Back
4: Action.BACK,
27: Action.BACK,
},
};

Expand Down
Loading