Skip to content

feat: autofocus the amount field when adding a transaction - #6

Merged
henrybuidotdev merged 1 commit into
mainfrom
feat/autofocus-amount-field
Nov 21, 2026
Merged

henrybuidotdev merged 1 commit into
mainfrom
feat/autofocus-amount-field

Conversation

@henrybuidotdev

Copy link
Copy Markdown
Owner

Summary

Opening Add transaction now puts focus on the amount field and, on phones, opens the number keyboard right away.

  • Autofocus: the amount input gets autofocus, but only when adding; editing a transaction is unchanged. After wire:navigate, the existing livewire:navigated hook in resources/js/app.js re-applies it.
  • Mobile keyboard: phone browsers only open the on-screen keyboard if focus happens during a user tap. After wire:navigate, the new page arrives after the tap is over, so the field was focused but the keyboard stayed closed (a reload worked).
    • Links marked data-keyboard="numeric" now focus a hidden placeholder input during the tap, which opens the keyboard. When the page swaps in, focus moves to the [autofocus] field and the placeholder is removed.
    • The placeholder is appended to <html>, outside <body>, because wire:navigate replaces the body.
    • The attribute is added to the three links that open the create page: the header + Add button, the empty state, and the supported-banks banner.

Tests

  • Added two browser tests in tests/Browser/ManualTransactionTest.php: the amount field is focused on the create page and not focused on the edit page.
  • These tests and the rest of the suite have not been run yet: the environment this was written in had PHP 8.3, and the project requires 8.4.
  • The keyboard opening can't be checked in a headless browser, so it needs a test on a real phone (iOS Safari and Android Chrome).

Generated by Claude Code

@henrybuidotdev
henrybuidotdev merged commit 2e0ea2d into main Nov 21, 2026
1 check passed
@henrybuidotdev
henrybuidotdev deleted the feat/autofocus-amount-field branch November 22, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants