keyman icon indicating copy to clipboard operation
keyman copied to clipboard

feat(web): implement subkey menu realignment for even columns (#9768)

Open MattGyverLee opened this issue 1 month ago • 2 comments

This is a pull request to resolve https://github.com/keymanapp/keyman/issues/9768

This change addresses a usability issue where subkey popup menus with even-numbered columns (2, 4, 6, 8) create ambiguous default selection. When there's an even number of columns, the centered position falls between two options, making it less predictable which character will be selected.

The solution shifts the popup menu alignment based on the base key's position on the keyboard:

  • Keys on the right side: shift popup menu left by half a key width
  • Keys on the left side: shift popup menu right by half a key width

This ensures one option always sits unambiguously under the default touch position, following the pattern used by Google's Gboard.

It is noted that the shift may be larger (up to a limit) if the selected key has an unusual width.

Changes:

  • Added numColumns instance variable to track column count
  • Modified reposition() to apply shift for even-column layouts
  • Added comprehensive unit tests for even/odd column scenarios
  • Existing bounds checking prevents menu overflow

Closes #9768 (https://github.com/keymanapp/keyman/issues/9768)

User Testing:

  1. Open a keyboard with larger popup key menus like EuroLatin.
  2. Longpress the g, which has 6 glyphs in the popup (the code only activates when there is an even number of rows).
  3. If this code is working, the popup should have shifted to the side so that one key is unambiguously selected. If not, sliding your finger left and right over the centerline will toggle between 2 keys.

MattGyverLee avatar Dec 08 '25 19:12 MattGyverLee

User Test Results

Test specification and instructions

ERROR: user tests have not yet been defined

keymanapp-test-bot[bot] avatar Dec 08 '25 19:12 keymanapp-test-bot[bot]

This pull request is from an external repo and will not automatically be built. The build must still be passed before it can be merged. Ask one of the team members to make a manual build of this PR.

keyman-server avatar Dec 08 '25 19:12 keyman-server