reset focus whenever navigating between pages, not just back/forward

This commit is contained in:
Drew Weymouth
2024-04-27 09:53:22 -07:00
parent 93cd796f1b
commit a00b395692
2 changed files with 4 additions and 3 deletions
+4
View File
@@ -197,6 +197,10 @@ func (b *BrowsingPane) doSetPage(p Page) bool {
if b.curPage != nil && b.curPage.Route() == p.Route() {
return false
}
// TODO: reset focus only if something inside the previous page had focus
if c := fyne.CurrentApp().Driver().CanvasForObject(b); c != nil {
c.Focus(nil)
}
b.curPage = p
if np, ok := p.(CanShowNowPlaying); ok {
// inform page of currently playing track
-3
View File
@@ -268,14 +268,11 @@ func (m *MainWindow) addShortcuts() {
for _, sh := range os.BackShortcuts {
m.Canvas().AddShortcut(&sh, func(_ fyne.Shortcut) {
m.BrowsingPane.GoBack()
// TODO: reset focus only if something inside the page had focus
m.Canvas().Focus(nil)
})
}
for _, sh := range os.ForwardShortcuts {
m.Canvas().AddShortcut(&sh, func(_ fyne.Shortcut) {
m.BrowsingPane.GoForward()
m.Canvas().Focus(nil)
})
}
if os.SettingsShortcut != nil {