Skip to content

fix(ask): keep the keyboard up while an option is pressed during Other typing - #255

Merged
andrebrait merged 11 commits into
kahme247:mainfrom
andrebrait:fix/ask-option-tap-keeps-keyboard
Oct 13, 2026
Merged

andrebrait merged 11 commits into
kahme247:mainfrom
andrebrait:fix/ask-option-tap-keeps-keyboard

Conversation

@andrebrait

@andrebrait andrebrait commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Follow-up to #252, found testing it on Android Chrome. While typing in a question's Other box, tapping an option still did not choose it on the first tap. The tap moved focus off the text box, so the keyboard closed and the panel resized before the click, and the click missed the option. #252 only guarded the footer buttons.

Changes

  • The focus guard moves from the footer to the whole dialog panel. On touch, while a text field in the panel has focus, a press anywhere in the panel outside a text field does not move focus. The click still fires, so the option, Cancel or Submit act on the first tap.
  • A tapped option label still focuses its radio once the click lands (label activation), so the keyboard closes after the choice is made, not before it.
  • Touch only ((pointer: fine) absent, the file's existing touchPointer()): a mouse keeps text selection and radio arrow-key navigation.
  • Tapping back into kept Other text no longer fires a focus event (focus never left), so the textarea's click now re-chooses Other as well as its focus.
  • Tests cover touch vs mouse, a focused field outside the panel, a focused radio inside it, and re-choosing Other by click. Each guard condition was mutation-checked: dropping any one fails a test.
  • When an ask opens, the hidden composer gives up focus, so the keyboard it raised closes instead of staying up until the first tap in the panel (which then resized the panel and missed). Found testing on Android Chrome.
  • On touch, only a focused text field counts as an open keyboard for the panel height. Focusing an option (Android focuses the radio on tap) used to switch the panel to the visible-area height under the finger, so the tap missed.
  • Answering releases the panel's focus as the answer is sent, so the keyboard closes on Submit instead of after omp acknowledges it (plus the 250ms hand-off). When the keyboard is collapsed (back button) while a panel text field has focus, the field is blurred, so the next tap does not raise the keyboard again for a moment.
  • CHANGELOG: the Unreleased entry from fix(ask): keep the keyboard up on a footer tap so Submit lands on the first tap #252 now covers option taps.

Verification

  • npm test: 1401 pass, 0 fail. tsc --noEmit and eslint clean.
  • Not checked on a physical phone yet: headless browsers do not raise a soft keyboard.

…r typing

kahme247#252 kept focus in the Other text box only for footer taps. Tapping an
option row moved focus too, so on Android Chrome the keyboard closed and
the panel resized before the click, and the first tap missed the option.

On touch, the panel now prevents mousedown's focus change anywhere
outside a text field while one of its text fields has focus. A tapped
label still focuses its radio once the click lands, so the keyboard
closes after the choice is made, not before. A mouse keeps normal
press behavior (text selection, radio arrow keys). Tapping back into
kept Other text fires no focus event any more, so a click re-chooses
Other as well.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 13, 2026
…essed during Other typing

Squashed from origin/fix/ask-option-tap-keeps-keyboard (77afab1) onto upstream/main.
The composer is hidden while an ask is open but kept its focus, so the
phone keyboard opened for the composer stayed up. The first tap in the
ask panel then blurred it, closing the keyboard and resizing the panel
before the click, which missed its target. Blur the hidden composer as
the ask opens.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 13, 2026
…essed during Other typing

Squashed from origin/fix/ask-option-tap-keeps-keyboard (956b6bd) onto upstream/main.
useMobileInputOpen treated any focus inside the panel on a touch device
as an open keyboard, so tapping an option (Android focuses the radio)
switched the panel to the visible-area height under the finger and the
tap missed. Only a focused text field raises a keyboard.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 13, 2026
…essed during Other typing

Squashed from origin/fix/ask-option-tap-keeps-keyboard (03ae679) onto upstream/main.
…en option

Codex review on kahme247#255:
- The pointer media query describes only the primary pointer. A touch tap
  on a mouse-primary laptop skipped the guard, and a mouse on a touch-first
  device lost text selection. Read pointerType from the press's
  pointerdown instead (touch and pen are guarded, mouse is not).
- With the guard, a tap on the radio itself (not its label) left focus in
  Other, so the keyboard stayed up and further typing re-chose Other.
  Focus the option when it changes.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 13, 2026
…essed during Other typing

Squashed from origin/fix/ask-option-tap-keeps-keyboard (171ff22) onto upstream/main.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 13, 2026
…essed during Other typing

Squashed from origin/fix/ask-option-tap-keeps-keyboard (171ff22) onto upstream/main.
… while typing

Found testing on Android Chrome:
- Submit kept the Other text box focused (the press guard) until omp
  acknowledged the answer and the 250ms hand-off ended, so the keyboard
  lingered. Release the panel's focus as the answer is sent.
- Collapsing the keyboard (back button) keeps the text box focused, so the
  next tap raised the keyboard again for a moment. When the visible area
  grows back while a panel text field has focus, blur it.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 13, 2026
…essed during Other typing

Squashed from origin/fix/ask-option-tap-keeps-keyboard (5649b80) onto upstream/main.
Codex review on kahme247#255: with interactive-widget: resizes-content (our
viewport meta) Android shrinks the layout viewport along with the visual
one, so visualViewport.height < innerHeight - 120 never held and the
keyboard-collapse blur never fired there. Compare the visible height to
the tallest seen at the current width instead; a width change (rotation)
starts over.
Codex review on kahme247#255: a width change reset the height baseline but kept
keyboardWasOpen, so rotating with the keyboard up looked like a collapse
and blurred the field mid-typing.
Codex review on kahme247#255: clearing keyboardWasOpen on a width change avoided
the false collapse but forgot the open keyboard, so its real collapse
afterwards was never seen. Track the keyboard by its own lowest height:
it closes when the visible area rises well above that, which a rotation
re-bases without dropping the open state.
Codex review on kahme247#255: on a fine-pointer desktop, shrinking the window by
more than 120px (or docking dev tools) looked like a keyboard opening, and
regrowing it blurred the focused field. Run the height history only where
a soft keyboard exists; a keyboard overlaying the page (visual viewport
below the layout one) still caps the panel on any device.
Codex review on kahme247#255: on a touchscreen laptop the primary pointer is
fine, so a touch tap's soft keyboard was neither capped for nor tracked.
Use the pointerType of the latest press, falling back to the primary
pointer query before any press, as the focus guard already does.
andrebrait added a commit to andrebrait/ompweb that referenced this pull request Oct 13, 2026
…essed during Other typing

Squashed from origin/fix/ask-option-tap-keeps-keyboard (1734bdd) onto upstream/main.
@andrebrait
andrebrait merged commit ac4d5ec into kahme247:main Oct 13, 2026
3 checks passed
@andrebrait
andrebrait deleted the fix/ask-option-tap-keeps-keyboard branch October 13, 2026 17:45
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.

1 participant