Skip to content

fix(bottom-sheet): stop swallowing the keyboard inset - #17

Open
romchornyi wants to merge 1 commit into
masterfrom
fix/bottom-sheet-keyboard-inset
Open

fix(bottom-sheet): stop swallowing the keyboard inset#17
romchornyi wants to merge 1 commit into
masterfrom
fix/bottom-sheet-keyboard-inset

Conversation

@romchornyi

@romchornyi romchornyi commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

BottomSheet(fillsHeight: true) applied edgesIgnoringSafeArea(.bottom). That API — like ignoresSafeArea(.all, edges:) — covers every safe-area region, .keyboard among them, so it switches off SwiftUI's keyboard avoidance for the whole sheet.

The intent, per the code around it, was only to let the sheet's background run under the home indicator. That is .container.

Any host with a text field inside a filled-height sheet loses keyboard avoidance: content that sits below the scrollable region ends up pinned under the keyboard with no way to reach it. dashwallet-ios hit exactly this on the contested-name sheet, where three action buttons sit outside the ScrollView and became unreachable while typing. It was worked around there with a Done keyboard toolbar and interactive scroll-to-dismiss — a workaround every future sheet with a text field would have needed too.

What was done?

Narrowed the region to .container, keeping the home-indicator behaviour and restoring keyboard avoidance.

-sheet.edgesIgnoringSafeArea(.bottom)
+sheet.ignoresSafeArea(.container, edges: .bottom)

ignoresSafeArea(_:edges:) is iOS 14+, matching both the component's @available(iOS 14, macOS 11, *) and the package floor, so no availability gate is needed.

The fillsHeight: false branch is untouched — it deliberately does not ignore the bottom inset, because .presentationDetents([.height]) adds that inset itself.

How Has This Been Tested?

  • swift build -c release — clean.
  • swift test — 16 tests, 0 failures.

Behavioural verification belongs on the consumer side: a filled-height sheet with a text field should now move with the keyboard, and the sheet background should still run under the home indicator.

Breaking Changes

None in API. Sheets that happened to rely on the keyboard being ignored would now move with it — that is the fix, not a regression.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

Summary by CodeRabbit

  • Bug Fixes
    • Updated full-height bottom sheets to continue extending beneath the home indicator while preserving keyboard avoidance for screens with text fields.
    • Replaced outdated safe-area handling to improve compatibility with current SwiftUI behavior.

`fillsHeight: true` applied `edgesIgnoringSafeArea(.bottom)`, which — like
`ignoresSafeArea(.all)` — covers every safe-area region, `.keyboard`
included. That switches off SwiftUI's keyboard avoidance for the whole
sheet, so a host with a text field gets its content pinned under the
keyboard with no way to scroll to it.

The intent was only to let the sheet's background run under the home
indicator, which is `.container`. Narrow it to that.

dashwallet-ios hit this on the contested-name sheet, where the three action
buttons sit outside the ScrollView and became unreachable while typing; it
was worked around there with a Done toolbar and interactive scroll-dismiss.
Every future sheet with a text field would have needed the same workaround.
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 776e4589-c8f9-42a3-9b44-6b824ce53f92

📥 Commits

Reviewing files that changed from the base of the PR and between 83cf65a and 434ae3c.

📒 Files selected for processing (1)
  • Sources/DashUIKit/Components/BottomSheet/BottomSheet.swift

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The fills-height bottom sheet replaces the deprecated safe-area modifier with .ignoresSafeArea(.container, edges: .bottom). The sheet still extends under the home indicator, while SwiftUI keyboard avoidance remains active.

Changes

Bottom sheet safe-area handling

Layer / File(s) Summary
Update fills-height safe-area behavior
Sources/DashUIKit/Components/BottomSheet/BottomSheet.swift
The fills-height branch now ignores only the container’s bottom safe area instead of using edgesIgnoringSafeArea(.bottom).

Estimated code review effort: 2 (Simple) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 434ae

The change restores keyboard avoidance for filled-height bottom sheets while retaining background extension under the home indicator. No actionable merge-blocking risk remains.

Suggested reviewers: jeanpierreroma

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing the bottom sheet from swallowing the keyboard inset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bottom-sheet-keyboard-inset

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@romchornyi

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

2 participants