[Refactor] Extract BottomSheet primitive from 3 PWA components#186
Merged
[Refactor] Extract BottomSheet primitive from 3 PWA components#186
Conversation
Contributor
|
Hi @samzong, DetailsInstructions for interacting with me using comments are available here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract the duplicated bottom-sheet pattern (backdrop + spring animation + drag-to-dismiss + drag handle + focus trap + escape key) from
AgentSelector,GatewayDebugLog, andSettingsSheetinto a singleBottomSheetprimitive.Type of change
[Refactor]internal cleanupWhy is this needed?
Three components copy-pasted ~40 lines of identical bottom-sheet infrastructure. The copies had silently diverged:
GatewayDebugLogwas missingrole="dialog",aria-modal,aria-label, focus trap, and focus restoreSettingsSheetwas missing focus trap and focus restoreWhat changed?
BottomSheet.tsx(~110 lines) — encapsulates backdrop, spring animation, drag-to-dismiss, drag handle, focus trap, focus restore, body scroll lock, escape key, safe area, and ARIA attributesAgentSelector.tsx(156 → 67 lines) — delegates sheet infrastructure toBottomSheet, keeps only agent-specific contentGatewayDebugLog.tsx(192 → 132 lines) — delegates sheet infrastructure, gainsrole="dialog"/aria-modal/aria-label/ focus trap / focus restoreSettingsSheet.tsx(165 → 113 lines) — delegates sheet infrastructure, gains focus trap / focus restoreArchitecture impact
docs/architecture-invariants.md: noneLinked issues
Closes #
Validation
pnpm lintpnpm testpnpm check:ui-contractpnpm check(full gate: lint + architecture + ui-contract + renderer-copy + i18n + dead-code + format + typecheck + test)Commands, screenshots, or notes:
Screenshots or recordings
No visual change — same animation, same thresholds, same styling. Behavioral fixes (focus trap, scroll lock) are not visible in screenshots.
Release note
NONE.Checklist
[Feat],[Fix],[UI],[Docs],[Refactor],[Build], or[Chore]