Skip to content

Fix: plain inputs unfocusable on click in scroll dialogs#84

Merged
judedanbo merged 2 commits into
mainfrom
fix/designation-field-click-focus
Jun 21, 2026
Merged

Fix: plain inputs unfocusable on click in scroll dialogs#84
judedanbo merged 2 commits into
mainfrom
fix/designation-field-click-focus

Conversation

@judedanbo

Copy link
Copy Markdown
Owner

Problem

The Designation field in the applicant Office dialog couldn't be focused by clicking it — only clicking its <label> worked.

Root cause

reka-ui's DialogOverlay registers @pointerdown.left.prevent on the overlay element. The DialogScrollContent variant nests the dialog content inside that overlay (so the backdrop can scroll), unlike the standard DialogContent where overlay and content are siblings. As a result, a pointerdown on a plain <input> bubbles up to the overlay and gets preventDefault() — which suppresses the compatibility mousedown event that natively focuses inputs.

Clicking the label still worked because that uses the native for= association. reka triggers (Select, DatePicker, HelpTip) are unaffected because they manage their own focus on pointerdown; only plain text inputs rely on the suppressed native behaviour — which is why only the Designation field (the lone plain input) was broken.

Fix

Add @pointerdown.stop on the DialogContent in DialogScrollContent.vue so an input's pointerdown never reaches the overlay's prevent handler. Outside-click dismissal is unaffected (reka keys off the pointerdown target being outside the content, not on bubbling through it). The fix lives in the shared primitive, so it repairs every scroll dialog containing a plain input.

App-wide audit

Reviewed all forms/fields/overlays. No other instances of this bug class exist: every other dialog/sheet uses the sibling-overlay pattern (immune), all menus/popovers are floating + portaled (immune), and there are no custom focus-stealing overlays. DialogScrollContent is used in 4 places but OfficeFormDialog was the only one with a plain input inside (the others are read-only detail views) — all covered by this shared fix.

Tests

Adds app/tests/e2e/office-dialog-focus.spec.ts — opens the Office dialog and asserts a real click focuses the Designation input, typing works, and backdrop-click still dismisses. Verified as a genuine guard: removing the fix makes the toBeFocused assertion fail.

🤖 Generated with Claude Code

judedanbo and others added 2 commits June 21, 2026 11:51
DialogScrollContent nests the content inside DialogOverlay (so the
backdrop can scroll), unlike the standard DialogContent where the two
are siblings. reka's DialogOverlay registers `@pointerdown.left.prevent`,
so a pointerdown on a plain <input> bubbles to the overlay and gets its
default prevented. That suppresses the compatibility mousedown event,
which is what natively focuses an input — so clicking the field did
nothing while clicking the label (native `for=`) still worked.

Stop pointerdown propagation at the content so it never reaches the
overlay handler. Outside-click dismissal is unaffected: it keys off the
pointerdown target being outside the content, not on bubbling through it.

Affected the Designation field in the applicant OfficeFormDialog (the
only plain text input there); the fix lives in the shared primitive so
it repairs every scroll dialog containing a plain input.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a Playwright regression test that opens the applicant Office dialog
and asserts a real click on the plain Designation <input> focuses it,
that typing flows through, and that backdrop-click dismissal still works.

Verified as a genuine guard: removing the @pointerdown.stop fix makes the
toBeFocused assertion fail. The dismissal check runs on a freshly-opened
dialog because reka absorbs the first outside pointerdown once focus has
entered a text input (pre-existing modal behaviour, unrelated to the fix).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@judedanbo judedanbo merged commit a6545eb into main Jun 21, 2026
1 check passed
@judedanbo judedanbo deleted the fix/designation-field-click-focus branch June 21, 2026 12: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.

1 participant