ios+mac: profile card gets a Done control — a Mac sheet has no other way out (#666)
macOS sheets have no swipe-down or click-outside, and Esc only works when a button claims cancelAction — the card was a trap. Done (top-right, the MembersSheet idiom) closes it and owns Esc, except while the rename editor is up, when the editor's Cancel takes Esc so it cancels the edit, not the card (matching the web).
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 file changed,
+13
−0
ios/LChatCore/Sources/LChatCore/MemberProfileSheet.swift+13 −0
diff --git a/ios/LChatCore/Sources/LChatCore/MemberProfileSheet.swift b/ios/LChatCore/Sources/LChatCore/MemberProfileSheet.swift| index 3603916..795402c 100644 |
| --- a/ios/LChatCore/Sources/LChatCore/MemberProfileSheet.swift |
| +++ b/ios/LChatCore/Sources/LChatCore/MemberProfileSheet.swift |
| @@ -50,7 +50,19 @@ public struct MemberProfileSheet<AvatarView: View>: View { |
| } |
| } |
| .padding(24) |
| + .padding(.top, 8) // room for the Done control above the avatar |
| .frame(minWidth: 280) |
| + // A sheet needs an explicit way out — macOS has no swipe-down and no |
| + // click-outside, and Esc only works when a button claims cancelAction. |
| + // While the rename editor is up, ITS Cancel owns Esc (cancel the edit, |
| + // not the card), so Done yields the shortcut. |
| + .overlay(alignment: .topTrailing) { |
| + Button("Done") { dismiss() } |
| + .buttonStyle(.borderless) |
| + .keyboardShortcut(editing ? nil : .cancelAction) |
| + .padding(10) |
| + .accessibilityLabel("Close profile") |
| + } |
| } |
| // The per-viewer names block: the pending keep/adopt choice, the |
| @@ -101,6 +113,7 @@ public struct MemberProfileSheet<AvatarView: View>: View { |
| .buttonStyle(.borderedProminent) |
| Button("Cancel") { editing = false } |
| .buttonStyle(.bordered) |
| + .keyboardShortcut(.cancelAction) // Esc cancels the edit, not the card |
| } |
| } |