Keep macOS channel search bar pinned right during search

The content type picker in the center .principal toolbar slot is what
constrains the .searchable field to the trailing edge. Dropping the
picker when a search was submitted let the toolbar reflow and the search
field re-center. Keep the picker in place and disable it while searching
instead.
This commit is contained in:
Arkadiusz Fal
2026-07-16 21:35:47 +02:00
parent e7886d9707
commit 6514cb426e

View File

@@ -380,10 +380,16 @@ struct ChannelView: View {
))
.toolbar {
#if os(macOS)
if supportsChannelTabs && !(isSearchActive && hasSearched) {
// Keep the content picker in the center `.principal` slot even while
// searching. Its presence is what pins the trailing `.searchable`
// field to the right edge dropping it (or making it zero-width)
// lets the search field re-center. During search it's disabled so the
// user can't switch tabs while the content area shows search results.
if supportsChannelTabs {
ToolbarItem(placement: .principal) {
contentTypePicker
.fixedSize()
.disabled(isSearchActive && hasSearched)
}
}
#else