Fix macOS native styling for search toolbar pickers and view options

The content type segmented picker rendered as a Liquid-Glass pill instead
of a native macOS segmented control. Wrapping a `.segmented` Picker in
`.opacity`/`.disabled`/`.accessibilityHidden`/`.fixedSize` (used to keep
toolbar items mounted-but-invisible for stable layout) inserts a hosting
layer that makes the toolbar fall back to the pill rendering.

- SearchView: filters button and content type picker are now always
  visible on macOS, rendered bare so `.segmented` keeps native styling.
- SearchView: don't reset the content type to .video on submit on macOS,
  so a pre-selected type (e.g. Playlists) is preserved (iOS unchanged).
- InstanceBrowseView: same pill fix, rendering the tab / content type
  pickers bare via conditional `if` instead of opacity-masking.
- ViewOptionsSheet / MediaBrowserViewOptionsSheet: use `.formStyle(.grouped)`
  for native macOS form styling in the options popover.
This commit is contained in:
Arkadiusz Fal
2026-06-15 08:07:40 +02:00
parent 77720ccea1
commit 1157eef201
4 changed files with 29 additions and 40 deletions

View File

@@ -291,29 +291,18 @@ struct SearchView: View {
}
#if os(macOS)
if searchInstance?.supportsSearchFilters == true {
if #available(macOS 26, *) {
// Items stay in the toolbar even before a search is submitted
// (invisible and inert) so the search field keeps a stable size.
ToolbarItem(placement: .navigation) {
searchFiltersToolbarButton
.opacity(hasSearched ? 1 : 0)
.disabled(!hasSearched)
.accessibilityHidden(!hasSearched)
}
.sharedBackgroundVisibility(hasSearched ? .automatic : .hidden)
ToolbarItem(placement: .principal) {
// Filters button + content type picker are always visible on macOS.
// The picker is rendered bare (no opacity/disabled/fixedSize wrappers):
// wrapping a `.segmented` Picker in those modifiers inserts a hosting
// layer that makes the toolbar fall back to a Liquid-Glass pill instead
// of the native segmented control.
ToolbarItem(placement: .navigation) {
searchFiltersToolbarButton
}
ToolbarItem(placement: .principal) {
if #available(macOS 26, *) {
contentTypePicker
.fixedSize()
.opacity(hasSearched ? 1 : 0)
.disabled(!hasSearched)
.accessibilityHidden(!hasSearched)
}
.sharedBackgroundVisibility(hasSearched ? .automatic : .hidden)
} else if hasSearched {
ToolbarItem(placement: .navigation) {
searchFiltersToolbarButton
}
ToolbarItem(placement: .principal) {
} else {
contentTypePicker
.fixedSize()
}
@@ -331,7 +320,11 @@ struct SearchView: View {
.searchable(text: searchTextBinding, prompt: Text(String(localized: "search.placeholder")))
.onSubmit(of: .search) {
searchViewModel?.cancelSuggestions()
#if !os(macOS)
// On macOS the content type picker is always visible, so preserve the
// user's chosen type instead of resetting it to .video on each submit.
searchViewModel?.filters.type = .video
#endif
if let filters = searchViewModel?.filters {
saveFilters(filters)
}