Skip to content

Commit 15f1890

Browse files
fix: correct remote file picker dropdown chevron alignment (#192)
There appears to be a bug when a View created using `NSView` is inside a `DisclosureGroup` label - regardless of the size of the `NSView`, it breaks the alignment of the chevron that's included on the DisclosureGroup label by default: ![](https://github.com/user-attachments/assets/d6a14a29-1b79-4a82-ac9f-62cf88142140) In #184 we added an `NSView` to the spinner, causing this issue. This is almost certainly a SwiftUI bug, and so we'll work around it by placing the spinner and error symbol to the right of the label by just setting a trailing padding on the text. The end result (with spinners on): ![](https://github.com/user-attachments/assets/50a7a7d3-bc68-4e02-b023-505b05759bf9)
1 parent c19b39a commit 15f1890

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

Coder-Desktop/Coder-Desktop/Views/FileSync/FilePicker.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,18 @@ struct FilePickerEntry: View {
123123
} label: {
124124
Label {
125125
Text(entry.name)
126-
ZStack {
127-
CircularProgressView(value: nil, strokeWidth: 2, diameter: 10)
128-
.opacity(entry.isLoading && entry.error == nil ? 1 : 0)
129-
Image(systemName: "exclamationmark.triangle.fill")
130-
.opacity(entry.error != nil ? 1 : 0)
131-
}
126+
// The NSView within the CircularProgressView breaks
127+
// the chevron alignment within the DisclosureGroup view.
128+
// So, we overlay the progressview with a manual offset
129+
.padding(.trailing, 20)
130+
.overlay(alignment: .trailing) {
131+
ZStack {
132+
CircularProgressView(value: nil, strokeWidth: 2, diameter: 10)
133+
.opacity(entry.isLoading && entry.error == nil ? 1 : 0)
134+
Image(systemName: "exclamationmark.triangle.fill")
135+
.opacity(entry.error != nil ? 1 : 0)
136+
}
137+
}
132138
} icon: {
133139
Image(systemName: "folder")
134140
}.help(entry.error != nil ? entry.error!.description : entry.absolute_path)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy