fix(shortcut-row): align down-swipe popup to the source letter row (#36)#58
Merged
Conversation
The below-key (down-swipe) shortcut popup reused the above-key placement formula in PopupKeysKeyboardView.showPopupKeysPanelInternal, compensated by a +container.getMeasuredHeight() hack in MainKeyboardView. That left the bottom popup with the wrong vertical gap/overlap vs the top one. Make the placement below-aware: setShowBelowAnchor() selects a mirrored y-formula that anchors the panel's visible content top to pointY (vs bottom for the above case), and MainKeyboardView passes pointY = key bottom directly. Horizontal anchoring is unchanged (already symmetric). Closes #36.
The real misalignment was horizontal, not vertical: the popup re-anchored on the swiped key via PopupKeysKeyboard's left/right split, which keys the split off the key's absolute x in the full keyboard. The bottom letter row is inset by the shift key (and bounded by backspace), so the leftmost letter (z) sits well right of x=0 and the icons got placed over the shift area — swiping down on z landed on a middle/right icon instead of the far-left one. The top row starts at x~0 so it looked fine, producing the top/bottom asymmetry. Fix: pin the shortcut popup's visible content left edge to the source letter row's left edge (leftmost normal key), so the 7 icons tile across the row and each letter maps to the icon directly above it (z->1st ... m->7th), draggable sideways. Normal long-press popups are unchanged (NO_ROW_ALIGN sentinel; they still anchor on the key). Verified on-device (S24+).
This was referenced Jun 7, 2026
AsafMah
added a commit
that referenced
this pull request
Jun 7, 2026
…row (#36) (#68) Follow-up to #58: the left-pin used natural icon width, so N icons tiled from the left and the far-right keys couldn't reach them. Now each icon is sized to rowWidth/iconCount (usable normal-key row span), so the N icons tile the whole row and a swipe maps proportionally — swiping from the i-th 1/N of the row selects the i-th icon. Threads a fixedKeyWidth into PopupKeysKeyboard.Builder (0 = default for normal/emoji popups); dividers are dropped in that mode so the icons tile exactly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36 — the down-swipe shortcut popup misalignment. Verified on-device (S24+).
Root cause (the real one: horizontal)
The popup re-anchored on the swiped key:
PopupKeysKeyboard.Buildersplits the icons left/right of the key based on the key's absolute x in the full keyboard (maxLeftKeys = coordXInParent / keyWidth). The bottom letter row is inset by the shift key on the left (and bounded by backspace on the right), so the leftmost letterzsits well right of x=0 → the split reserved left-side columns and placed icons over the shift area. Result: swiping down onzlanded on a middle/right icon instead of the far-left one. The top row starts at x≈0, so it looked correct — hence the top/bottom asymmetry (exactly the “shift/backspace irregular keys” hunch in the issue).Fix
Pin the shortcut popup's visible content left edge to the source letter row's left edge (leftmost normal key in the swiped row), so the icons tile across the row and each letter maps to the icon directly above it (
z→1st …m→7th), draggable sideways. Threaded via arowAlignedLeftXargument +setRowAlignedLeftX(...); normal long-press popups are unchanged (NO_ROW_ALIGNsentinel — they still anchor on the key).The earlier commit in this PR also makes the below-key vertical placement explicit (
setShowBelowAnchor, anchoring the panel top to the key bottom) so the popup sits flush below the row.Verification
Note
Icon width is the keyboard's natural key width; for the standard 7-letter row + 7 icons it tiles 1:1. If a layout's row key-count ≠ icon count, the left edge still aligns and it degrades gracefully (exact row-width tiling could be a follow-up).