Skip to content

iOSでプリセット名モーダルがキーボード表示時に画面外に押し出されるバグを修正 - #5572

Merged
TinyKitten merged 2 commits into
devfrom
feature/fix-save-preset-modal-ios-keyboard
Mar 10, 2026
Merged

TinyKitten merged 2 commits into
devfrom
feature/fix-save-preset-modal-ios-keyboard

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Mar 10, 2026 •

Copy link
Copy Markdown
Member

Summary

  • iPhone 16等のiOSデバイスで SavePresetNameModal を開くと、autoFocus によりキーボードが即座に表示され、KeyboardAvoidingView(behavior="padding")がモーダルコンテンツを画面外に押し出してバックドロップだけが残るバグを修正
  • autoFocus をiOSでは無効化し、モーダルアニメーション完了後(300ms後)に手動で textInputRef.current?.focus() を呼ぶことでキーボード表示タイミングを遅延

Test plan

  • iPhone 16(またはiOSシミュレータ)でプリセット保存モーダルを開き、モーダルが正しく表示されることを確認
  • キーボードが表示された状態でもモーダルコンテンツが画面内に収まることを確認
  • Androidでは引き続き autoFocus が動作することを確認
  • 方向選択オプション付きの場合でもモーダルが正しく表示されることを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 改善
    • プリセット名モーダルでのテキスト入力フォーカス挙動をプラットフォーム別に最適化しました。iOSではモーダル表示とキーボードのレイアウト完了を待つ短い遅延を導入して正しくフォーカスし、iOS以外では自動フォーカスを有効化して入力開始をスムーズにします。

@github-actions github-actions Bot added the react label Mar 10, 2026
@coderabbitai

coderabbitai Bot commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 76a7db98-a303-437a-ac1d-2c873a11a051

📥 Commits

Reviewing files that changed from the base of the PR and between d5d2f43 and 0879e09.

📒 Files selected for processing (1)
  • src/components/SavePresetNameModal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/SavePresetNameModal.tsx

📝 Walkthrough

Walkthrough

SavePresetNameModalで、表示時のiOS向けフォーカス挙動を追加しました。モーダルがvisibleになったとき、iOSではモーダルアニメーションとキーボード回避レイアウト完了後に300ms遅延でTextInputにフォーカスし、アンマウント時にタイマーをクリアします。TextInputのautoFocus条件をiOS以外に変更しました。

Changes

Cohort / File(s) Summary
iOS focus & autofocus change
src/components/SavePresetNameModal.tsx
iOSでのモーダル表示時に300ms遅延してTextInputへフォーカスするロジックを追加。アンマウント時にタイマーをクリーンアップ。TextInputのautoFocus挙動をiOS向けから非iOS向けへ反転。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 うさぎがポケットからタイマー出す
iOSでそっと三百ミリ待つよ
モーダルが揺れて、入力が呼ぶ
フォーカスが落ち着き、指が踊る
小さな遅延で笑顔が戻る

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、iOS デバイスにおけるプリセット名モーダルのキーボード表示時の不具合修正という主要な変更を明確に要約しており、簡潔で具体的である。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/fix-save-preset-modal-ios-keyboard

Comment @coderabbitai help to get the list of available commands and usage tips.

@TinyKitten TinyKitten self-assigned this Mar 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/components/SavePresetNameModal.tsx (1)

112-118: iOS 向けの遅延フォーカス処理は適切です。

モーダルアニメーション完了後にフォーカスを設定するアプローチは、KeyboardAvoidingView との競合を避ける有効な解決策です。

ただし、300 というマジックナンバーについて、モーダルアニメーション完了を待つ意図であることをコメントで明記すると、将来のメンテナンス性が向上します。

♻️ コメント追加の提案
      if (Platform.OS === 'ios') {
+        // モーダルアニメーション完了後にフォーカスを設定し、
+        // KeyboardAvoidingView がコンテンツを押し出すのを防ぐ
        const timer = setTimeout(() => {
          textInputRef.current?.focus();
        }, 300);
        return () => clearTimeout(timer);
      }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/SavePresetNameModal.tsx` around lines 112 - 118, Add an inline
comment above the iOS-specific setTimeout block in SavePresetNameModal (the
Platform.OS === 'ios' branch around the setTimeout that calls
textInputRef.current?.focus()) explaining that the 300ms delay is intentionally
chosen to wait for the modal animation/KeyboardAvoidingView to finish before
focusing the input; optionally note that it may be adjusted per
platform/animation changes so future maintainers understand it's not arbitrary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/SavePresetNameModal.tsx`:
- Around line 112-118: Add an inline comment above the iOS-specific setTimeout
block in SavePresetNameModal (the Platform.OS === 'ios' branch around the
setTimeout that calls textInputRef.current?.focus()) explaining that the 300ms
delay is intentionally chosen to wait for the modal
animation/KeyboardAvoidingView to finish before focusing the input; optionally
note that it may be adjusted per platform/animation changes so future
maintainers understand it's not arbitrary.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 133b781b-59c3-463e-b81d-a5271f0206c6

📥 Commits

Reviewing files that changed from the base of the PR and between 40ed9bb and d5d2f43.

📒 Files selected for processing (1)
  • src/components/SavePresetNameModal.tsx

@TinyKitten
TinyKitten merged commit 09aee4c into dev Mar 10, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the feature/fix-save-preset-modal-ios-keyboard branch March 10, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant