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

[FIX/FEATURE] Make virtual keyboard compatible with all inputs #3961

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arielj
Copy link
Collaborator

@arielj arielj commented Aug 17, 2024

This PR updates the virtual keyboard to solve a few issues and makes it compatible with all text inputs.

Before this, the virtual keyboard when using a gamepad was only valid for the search box in the library and it was partially compatible with the search box in the winetricks dialog (it would open, but behind the dialog, so it was unusable).

This PR has a few changes:

  • Use showModal for dialogs instead of the popover API, that fixes the issue with the keyboard appearing behind the winetricks dialog (closes Built-in virtual keyboard is behind the winetricks modal #3197 )
  • Fix an issue where the x button of the search inputs was not working with the controller (instead of clicking the SVG icon, we now click the parent button)
  • Updates the gamepad handling to open the keyboard for any text input and to send events to it, not only search inputs
  • Updates the TextInputField to support the input events sent by the keyboard module (we can't use react's onChange flow)
  • Because of the previous item, now the onChange function passed to TextInputField receives the new value and not a react on change event, so I had to updated all the places that used that to replace the e.target.value with newValue

There are 2 issues I can't find how to fix (both errors are present in the main branch already though, so leaving the out of the scope of this):

  • when navigating the elements inside a modal, when we reach the top/bottom, if we continue moving the stick it will actually scroll the library for example, I can't find any way to prevent this (seems to be some issue with the spatial navigation feature we use)
  • when displaying search results below the input (either the list of games in the library or the list of winetricks packages found), the elements are not focusable. This is also some issue with the spatial navigation that can't seem to move the focus to elements inside a container with a predefined height or max-height

Use the following Checklist if you have changed something on the Backend or Frontend:

  • Tested the feature and it's working on a current and clean install.
  • Tested the main App features and they are still working on a current and clean install. (Login, Install, Play, Uninstall, Move games, etc.)
  • Created / Updated Tests (If necessary)
  • Created / Updated documentation (If necessary)

@arielj arielj added the pr:ready-for-review Feature-complete, ready for the grind! :P label Aug 17, 2024
@arielj arielj requested review from a team, flavioislima, CommandMC, Etaash-mathamsetty, Nocccer and imLinguin and removed request for a team August 17, 2024 03:52
@@ -10,6 +10,5 @@
</head>
<body>
<div id="root"></div>
<div class="simple-keyboard"></div>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was not used, we have another div for this inside the react app

Comment on lines +34 to +36
const wrapper = document.querySelector(
'.simple-keyboard-wrapper'
) as HTMLDialogElement
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const wrapper = document.querySelector(
'.simple-keyboard-wrapper'
) as HTMLDialogElement
const wrapper = document.querySelector<HTMLDialogElement>(
'.simple-keyboard-wrapper'
)

This probably won't lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:ready-for-review Feature-complete, ready for the grind! :P
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Built-in virtual keyboard is behind the winetricks modal
2 participants