Skip to content

Commit 1b3ffa0

Browse files
authored
fix: preview SQL popover not presenting from toolbar button (#740)
Move .popover() from the disabled Button to an always-enabled VStack wrapper so SwiftUI can anchor the popover regardless of button state. Also remove attachmentAnchor: .point(.bottom) which caused incorrect positioning in macOS toolbars.
1 parent a6d4b37 commit 1b3ffa0

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

TablePro/Views/Toolbar/TableProToolbarView.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,17 @@ struct TableProToolbar: ViewModifier {
147147
}
148148

149149
ToolbarItem(placement: .primaryAction) {
150-
Button {
151-
actions?.previewSQL()
152-
} label: {
153-
let langName = PluginManager.shared.queryLanguageName(for: state.databaseType)
154-
Label("Preview \(langName)", systemImage: "eye")
150+
VStack {
151+
Button {
152+
actions?.previewSQL()
153+
} label: {
154+
let langName = PluginManager.shared.queryLanguageName(for: state.databaseType)
155+
Label("Preview \(langName)", systemImage: "eye")
156+
}
157+
.help(String(format: String(localized: "Preview %@ (⌘⇧P)"), PluginManager.shared.queryLanguageName(for: state.databaseType)))
158+
.disabled(!state.hasDataPendingChanges || state.connectionState != .connected)
155159
}
156-
.help(String(format: String(localized: "Preview %@ (⌘⇧P)"), PluginManager.shared.queryLanguageName(for: state.databaseType)))
157-
.disabled(!state.hasDataPendingChanges || state.connectionState != .connected)
158-
.popover(isPresented: $state.showSQLReviewPopover, attachmentAnchor: .point(.bottom)) {
160+
.popover(isPresented: $state.showSQLReviewPopover) {
159161
SQLReviewPopover(statements: state.previewStatements, databaseType: state.databaseType)
160162
}
161163
}

0 commit comments

Comments
 (0)