diff --git a/PVUI/Sources/PVSwiftUI/SideMenu/MenuItemView.swift b/PVUI/Sources/PVSwiftUI/SideMenu/MenuItemView.swift index cec9952d62..ef7e048441 100644 --- a/PVUI/Sources/PVSwiftUI/SideMenu/MenuItemView.swift +++ b/PVUI/Sources/PVSwiftUI/SideMenu/MenuItemView.swift @@ -21,12 +21,14 @@ struct MenuItemView: SwiftUI.View { var icon: SettingsIcon var rowTitle: String + var isFocused: Bool + var action: () -> Void @ObservedObject private var themeManager = ThemeManager.shared - @Environment(\.isFocused) private var isFocused: Bool var body: some SwiftUI.View { + let _ = print("MenuItemView '\(rowTitle)' isFocused: \(isFocused)") Button { action() } label: { diff --git a/PVUI/Sources/PVSwiftUI/SideMenu/SideMenuView.swift b/PVUI/Sources/PVSwiftUI/SideMenu/SideMenuView.swift index 049177b222..500d20561d 100644 --- a/PVUI/Sources/PVSwiftUI/SideMenu/SideMenuView.swift +++ b/PVUI/Sources/PVSwiftUI/SideMenu/SideMenuView.swift @@ -217,7 +217,7 @@ SideMenuView: SwiftUI.View { Divider() .foregroundStyle(themeManager.currentPalette.menuDivider.swiftUIColor) - MenuItemView(icon: .named("prov_home_icon"), rowTitle: "Home") { + MenuItemView(icon: .named("prov_home_icon"), rowTitle: "Home", isFocused: focusedItem == "home") { delegate.didTapHome() } .focusableIfAvailable() @@ -226,7 +226,7 @@ SideMenuView: SwiftUI.View { Divider() .foregroundStyle(themeManager.currentPalette.menuDivider.swiftUIColor) - MenuItemView(icon: .named("prov_settings_gear"), rowTitle: "Settings") { + MenuItemView(icon: .named("prov_settings_gear"), rowTitle: "Settings", isFocused: focusedItem == "settings") { delegate.didTapSettings() } .focusableIfAvailable() @@ -241,7 +241,7 @@ SideMenuView: SwiftUI.View { Divider() .foregroundStyle(themeManager.currentPalette.menuDivider.swiftUIColor) - MenuItemView(icon: .sfSymbol("checklist"), rowTitle: "Add Games") { + MenuItemView(icon: .sfSymbol("checklist"), rowTitle: "Add Games", isFocused: focusedItem == "imports") { delegate.didTapImports() } .focusableIfAvailable() @@ -261,7 +261,7 @@ SideMenuView: SwiftUI.View { ForEach(sortedConsoles(), id: \.self) { console in Divider() .foregroundStyle(themeManager.currentPalette.menuDivider.swiftUIColor) - MenuItemView(icon: .named(console.iconName, PVUIBase.BundleLoader.myBundle), rowTitle: console.name) { + MenuItemView(icon: .named(console.iconName, PVUIBase.BundleLoader.myBundle), rowTitle: console.name, isFocused: focusedItem == console.identifier) { delegate.didTapConsole(with: console.identifier) } .focusableIfAvailable()