Repository navigation
feat(bottom-sheet): let the host name the header buttons of a stacked sheet - #87
Conversation
… sheet Two BottomSheets stacked both answered to navigationbar-close and navigationbar-back. View.bottomSheetHeaderIdentifiers(back:close:) puts the host's identifiers in the environment, and the header passes them to NavigationBarElement.button(accessibilityIdentifier:action:); nil keeps the fixed ones. It reaches BottomSheet.selfSizing too. Closes dashpay#86. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
romchornyi
left a comment
There was a problem hiding this comment.
✅ No blockers, no major · 4 non-blocking recommendations — reviewed at 7b408626f4
| Level | Verdict | |
|---|---|---|
| 1 · Idea | ✅ valid | #86: two stacked sheets both answer to navigationbar-close / navigationbar-back. |
| 2 · Architecture | ✅ right layer | An environment value reaches selfSizing and leaves every signature as it is. |
| 3 · Completeness | ✅ complete | Back and close both covered; docs updated. |
| 4 · Code | ✅ clean | CI green. |
4 non-blocking recommendations
- Naming one button resets the other's outer name —
BottomSheet.swift#L193— the modifier writes both values, and thenildefault clears a name set further up:.bottomSheetHeaderIdentifiers(close: "x")under a scope that named the back button gives itnavigationbar-backagain. Writing only the values passed would keep it. - The names reach every nested sheet —
navigation-and-containers.md#L174— naming the outer sheet gives an inner one the same names, so the double match comes back under the custom identifier. The docs say so; scoping the value to the nearest sheet (clearing it for the sheet's own content) would make it impossible. - The docs could name the UIKit boundary — same line — the names pass through SwiftUI
.sheet/.fullScreenCover, not into aBottomSheetaUIHostingControllerpresents, which the host app also does. - No committed test —
BottomSheet.swift#L147— swapping the back and close values would stay green. Adump-based check like #85's overload test would pin the header wiring.
Review details
Levels 1–3 inline, level 4 /code-review high.
🤖 Reviewed with Claude Code
Review on dashpay#87: - bottomSheetHeaderIdentifiers writes only the names passed, so naming the close button keeps a back name set further up. - A BottomSheet clears the names for its content, so a sheet presented from it keeps its own fixed identifiers instead of inheriting the outer names. - The docs say the names do not cross into a sheet a UIKit controller presents. - BottomSheet.headerIdentifiers(back:close:) maps the names to the two buttons, with a test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review addressed in 9803494:
Checked in a throwaway XCUITest app: an outer sheet with |
romchornyi
left a comment
There was a problem hiding this comment.
✅ No blockers, no major · all 4 recommendations closed — re-reviewed at 98034943a6
| Level | Verdict | |
|---|---|---|
| 1 · Idea | ✅ valid | Unchanged. |
| 2 · Architecture | ✅ right layer | Unchanged. |
| 3 · Completeness | ✅ complete | Unchanged. |
| 4 · Code | ✅ clean | The diff since 7b408626f4 scopes the names to their sheet and adds a test; CI green. |
Closed since the last review
- The modifier writes only the names passed (
transformEnvironment), so naming one button keeps the other's outer name. - A
BottomSheetclears the names for its content, so a sheet presented from it keeps its own. - The docs name the UIKit boundary.
-
BottomSheetHeaderIdentifierTestspins which name goes to which button.
🤖 Reviewed with Claude Code
Issue being fixed or feature implemented
Closes #86.
BottomSheetdraws its header buttons withNavigationBarElement.back.buttonand.close.button, so when one sheet is presented over another, both close buttons answer tonavigationbar-close(and both back buttons tonavigationbar-back). #85 addedbutton(accessibilityIdentifier:action:), but the sheet's header had no way to receive one.What was done?
View.bottomSheetHeaderIdentifiers(back:close:)puts the host's identifiers in the environment; the header passes them tobutton(accessibilityIdentifier:action:).nilkeeps a button's fixed identifier.initparameter: it reaches a sheet built byBottomSheet.selfSizing(...), which returnssome View, and leaves every existing signature as it is. A sheet presented from inside a named one inherits the names, so the docs say to give it its own.docs/navigation-and-containers.md: the identifiers of the header buttons and the modifier, with an example.How Has This Been Tested?
BottomSheetand, from it, aBottomSheet.selfSizingwith.bottomSheetHeaderIdentifiers(back: "inner-back", close: "inner-close"). With both open,navigationbar-close,navigationbar-back,inner-closeandinner-backeach match one button. Unit tests cannot read SwiftUI's accessibility tree, so no committed test reads the rendered header.conventions.sh.Before / After
Only accessibility identifiers change; nothing is drawn differently.
Breaking Changes
None: a new modifier; without it the buttons keep their identifiers.
Checklist:
🤖 Generated with Claude Code