Skip to content

fix(nextjs): stop hidden dialogs raising the phone keyboard on load - #60

Merged
JamesCarnley merged 1 commit into
mainfrom
fix/mobile-keyboard-autofocus
Nov 4, 2026
Merged

JamesCarnley merged 1 commit into
mainfrom
fix/mobile-keyboard-autofocus

Conversation

@JamesCarnley

Copy link
Copy Markdown
Member

Summary

  • The "Add folder / file / list" and "New Sort" dialogs now focus their Name input when they open, instead of using React autoFocus.
  • On a phone, opening /explorer no longer brings up the on-screen keyboard.

Why

Both dialogs stay mounted while closed. daisyUI's .modal overrides the UA dialog:not([open]) { display: none } with display: grid; opacity: 0, so the closed dialogs' inputs stay focusable. React's autoFocus focuses on mount, so at page load the hidden "Enter file name" input took focus and the phone raised its keyboard. Reproduced on app.efs.eth.limo at phone size: document.activeElement was that hidden input.

The List name input keeps autoFocus: it only mounts once the dialog is open as a List. The other autoFocus uses in the explorer (inline label/description edits, the mirror URI field, InputBase's opt-in reFocus) mount on a user action, so they are unchanged.

Permanence tier

Ephemeral (packages/nextjs debug UI).

Specs / ADRs touched or checked

  • N/A. No spec or ADR covers dialog focus.

Test plan

  • Dev server on Sepolia at phone size (Android UA): nothing is focused after /explorer loads. Live site before the fix: the hidden file-name input is focused.
    • Add -> Folder, File and List each focus their Name field on open; New Sort focuses its name field.
  • yarn next:lint, yarn hardhat:lint, yarn next:check-types, yarn docs:check, nextjs unit tests (184 pass).
  • Not tested on a physical phone.

Review notes (P3, not changed here): closed daisyUI dialogs are still reachable with Tab / the mobile "next" key because of the display: grid override; adding inert to closed dialogs would fix it. CreateSortModal has no onCancel, so Escape closes it natively while the parent keeps isOpen; re-open still works. Both predate this PR.

Agents involved

  • Dev: Claude Opus 5.5
  • Review: Claude Opus 5.5 (independent code-review subagent; no P1/P2 findings)
  • Orchestrator: James

🤖 Generated with Claude Code

Opening /explorer on a phone brought up the on-screen keyboard. The
"Add folder / file / list" and "New Sort" dialogs stay mounted while
closed, and their Name inputs used React's autoFocus, which focuses on
mount, not on open. So at page load the hidden "Enter file name" input
took focus (reproduced on app.efs.eth.limo at phone size).

Both dialogs now focus their Name input when they open instead. The
List name input keeps autoFocus because it only mounts once the dialog
is open as a List. The other autoFocus uses in the explorer (inline
label/description edits, the mirror URI field) mount on a user action,
so they're left alone.

Verified on the dev server pointed at Sepolia at phone size: nothing
is focused after load; + Add -> Folder, File and List each focus their
Name field; New Sort focuses its name field. Type check, eslint and
prettier pass on both files.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Reviewed-by: Claude Opus 5.5 <noreply@anthropic.com>
Tested-by: Claude Opus 5.5 <noreply@anthropic.com>
Permanence-tier: Ephemeral
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T02:27:51.420763Z 6bb90a2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@JamesCarnley
JamesCarnley merged commit 9cd33e4 into main Nov 4, 2026
3 checks passed
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