fix(macos): reserve exec approval dialog layout space (#75470)

Merged via squash.

Prepared head SHA: 8a3ca92150
Co-authored-by: ngutman <1540134+ngutman@users.noreply.github.com>
Co-authored-by: ngutman <1540134+ngutman@users.noreply.github.com>
Reviewed-by: @ngutman
This commit is contained in:
Nimrod Gutman
2026-05-01 09:32:47 +03:00
committed by GitHub
parent be918636ab
commit b0b627e5a9
3 changed files with 37 additions and 2 deletions

View File

@@ -253,12 +253,11 @@ enum ExecApprovalsPromptPresenter {
}
@MainActor
private static func buildAccessoryView(_ request: ExecApprovalPromptRequest) -> NSView {
static func buildAccessoryView(_ request: ExecApprovalPromptRequest) -> NSView {
let stack = NSStackView()
stack.orientation = .vertical
stack.spacing = 8
stack.alignment = .leading
stack.translatesAutoresizingMaskIntoConstraints = false
stack.widthAnchor.constraint(greaterThanOrEqualToConstant: 380).isActive = true
let commandTitle = NSTextField(labelWithString: "Command")
@@ -337,6 +336,10 @@ enum ExecApprovalsPromptPresenter {
footer.font = NSFont.systemFont(ofSize: NSFont.smallSystemFontSize)
stack.addArrangedSubview(footer)
// NSAlert reserves accessory space from the view frame, not from Auto Layout constraints.
// Give the top-level accessory an explicit frame so its subviews do not paint over the
// alert title, message, and buttons while the frame remains zero-sized.
stack.frame = NSRect(origin: .zero, size: stack.fittingSize)
return stack
}