Dock the calculator's operator bar above the keyboard on touch screens

GF
1d ago
+98-17

Stacked PR. Base is stack/money-field-5944-core (= head of #6032). Once #6032 is merged, this PR can be retargeted to main and shows only its own part.

Follow-up to #6032: the docked operator bar is a touch-layout change on top of it, not part of the issue #6032 resolves.

Problem

On a phone the calculator's operator row opened inside the field. It pushed the rest of the form down, and in a narrow field (half a row, or a budget column) the five buttons and the result got only a few pixels each.

Change

On a touch screen (pointer: coarse) the operator row is a bar across the whole screen, docked above the on-screen keyboard. The controller keeps --money-field-keyboard-inset at the keyboard's height through visualViewport, on iOS and Android. The result and any hint show on top of the bar. The field never changes its size, however narrow it is, and the buttons stay at least 44 px tall to tap. While the bar is closed, hints stay in the field. Desktop is unchanged.

Effects on other parts of the app

Only the shared money field's markup and controller. No change to parsing, rounding or what is submitted.

Screenshots

Phone (390 px, touch), calculator open:

Validation

  • System tests for the docked bar, its keyboard inset and that hints and the result move to the bar while it is open.
  • Rubocop, ERB lint, Biome and Brakeman clean.

How this fits together

The money field work is split into small PRs that build on each other. Review from the top of this list; each stacked PR's base is a stack/* copy of the PR below it, so its diff shows only its own change.

  1. #6032: bounds checked on the submitted amount, hints for ignored input, parentheses. Base: main.
  2. #6033: operator bar docked above the on-screen keyboard. Base: #6032.
  3. #5833: every amount input uses the money field. Base: #6033.
  4. #5850: a rejected transfer keeps its input; comma exchange rates. Base: #5833.
  5. #5939: the remaining decimal fields (quantities, rates) read comma decimals. Base: #5850.
  6. #6035: plain-number fields without the calculator for settings, rates and rule/filter limits. Base: #5939.

Standalone: #6034 (phone layout of goal, vehicle and settings number rows). Base: main; it does not depend on the stack.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • On touch-screen devices, expanded calculator controls appear in a screen-wide bar above the on-screen keyboard, with the result preview and input hint available in the bar.
    • The bar adjusts to changes in the visible screen area while the calculator is open, and its controls fit within the screen width.
    • Preview and hint updates appear across all matching fields. The amount field keeps its height while the bar is open.
  • Bug Fixes
    • Calculator preview and hint behavior remains consistent when opening or closing the operator bar on touch screens.