Files
buzz/mobile/lib/features
John Matthew Tennant 9ccad95344 feat(mobile): accept mentions with Tab and send with Enter on hardware keyboards (#8733)
## Summary

The mobile composer ignored Tab and Enter from hardware keyboards. Tab
and Enter now accept the first selectable mention or channel suggestion
while its picker is visible. Otherwise Enter or numpad Enter sends the
message when attachment controls are closed. Enter leaves the draft
untouched while an attachment surface is open. Tab leaves the draft
unchanged while the picker is hidden or the field is read-only. A
visible picker with no selectable row consumes Tab and Enter without
sending. Only unmodified Tab accepts suggestions. Native attachment and
emoji pickers own keyboard input until dismissal. Keyboard suggestion
acceptance and sending use the same selection haptic as touch. Modified
Enter and active IME composition retain normal text-field handling.

Android IMEs can emit Enter as a key event too. Sending requires a
mapped physical Enter key on Android, so scan-code-free IME Enter keeps
newline handling.

### Related issue

None found.

### Testing

The composer widget regressions reproduce ignored Tab/Enter before the
feature and an unintended send from Android IME Enter before its guard.
The picker regressions cover Enter accepting a visible suggestion, Enter
and numpad Enter retaining an Android draft while the attachment menu is
open, and Tab leaving hidden or read-only suggestions untouched. They
verify suggestion acceptance, error-only picker handling, native
attachment popover ownership, modified Tab, sending, software Return and
Android physical-key handling. Rapid Enter while member scanning is
pending sends only once through the existing draft revision guard.

Native validation and screenshots use an isolated Android API 28
ComposeBar harness at `09fb673f9`, with an observed send callback and a
test-only native key injector. Physical Enter sends once and clears the
draft; IME Enter inserts a newline without sending. Native validation of
picker acceptance, visibility and read-only handling remains
outstanding.

### Screenshots

| Physical Enter sends and clears the draft | IME Enter keeps a newline
without sending |
| --- | --- |
| ![Physical Enter
sends](https://github.com/user-attachments/assets/bf1b33ca-2f07-475a-b762-38c05e693163)
| ![IME Enter keeps a
newline](https://github.com/user-attachments/assets/6be835ad-a81a-4c6d-84c7-46549b858aee)
|

| Mention suggestions | Tab accepts the suggestion |
| --- | --- |
| ![Mention
suggestions](https://github.com/user-attachments/assets/7a5f0365-955c-4f98-9090-dd5d9ee919d3)
| ![Tab accepts a
mention](https://github.com/user-attachments/assets/cf947194-f2ad-4aae-9a47-4c465ca25444)
|

---------

Signed-off-by: John Tennant <jtennant@squareup.com>
Signed-off-by: Tom Brow <tomb@squareup.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Oliver <e78152627ea32fbacb070e5047afcfb8e409fa3343d9e618227baacca5b5e607@buzz.block.builderlab.xyz>
Co-authored-by: Tom Brow <tomb@squareup.com>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz>
2026-11-16 15:01:21 -05:00
..