macOS: Command Pallete Improvements (#7171)

As discussed in #7165, this PR resolves two issues with the command
pallete on macOS.
1. The flashing of a command passing out of view was caused by the
`withAnimation` function. Removing this closure resolved this issue.
2. The current implementation kept the selected command anchored to the
middle of the pallete. However, most command pallates allow you to key
through the visible options, only scrolling when your selection hits the
boundary. I resolved this by removing the `anchor: .center` parameter
for the `scrollTo` command.
This commit is contained in:
Mitchell Hashimoto 2025-04-23 08:35:33 -07:00 committed by GitHub
commit f2c798d319
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -177,11 +177,8 @@ fileprivate struct CommandTable: View {
.frame(maxHeight: 200)
.onChange(of: selectedIndex) { _ in
guard selectedIndex < options.count else { return }
withAnimation {
proxy.scrollTo(
options[Int(selectedIndex)].id,
anchor: .center)
}
proxy.scrollTo(
options[Int(selectedIndex)].id)
}
}
}