reset focus whenever navigating between pages, not just back/forward
This commit is contained in:
@@ -197,6 +197,10 @@ func (b *BrowsingPane) doSetPage(p Page) bool {
|
|||||||
if b.curPage != nil && b.curPage.Route() == p.Route() {
|
if b.curPage != nil && b.curPage.Route() == p.Route() {
|
||||||
return false
|
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
|
b.curPage = p
|
||||||
if np, ok := p.(CanShowNowPlaying); ok {
|
if np, ok := p.(CanShowNowPlaying); ok {
|
||||||
// inform page of currently playing track
|
// inform page of currently playing track
|
||||||
|
|||||||
@@ -268,14 +268,11 @@ func (m *MainWindow) addShortcuts() {
|
|||||||
for _, sh := range os.BackShortcuts {
|
for _, sh := range os.BackShortcuts {
|
||||||
m.Canvas().AddShortcut(&sh, func(_ fyne.Shortcut) {
|
m.Canvas().AddShortcut(&sh, func(_ fyne.Shortcut) {
|
||||||
m.BrowsingPane.GoBack()
|
m.BrowsingPane.GoBack()
|
||||||
// TODO: reset focus only if something inside the page had focus
|
|
||||||
m.Canvas().Focus(nil)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for _, sh := range os.ForwardShortcuts {
|
for _, sh := range os.ForwardShortcuts {
|
||||||
m.Canvas().AddShortcut(&sh, func(_ fyne.Shortcut) {
|
m.Canvas().AddShortcut(&sh, func(_ fyne.Shortcut) {
|
||||||
m.BrowsingPane.GoForward()
|
m.BrowsingPane.GoForward()
|
||||||
m.Canvas().Focus(nil)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if os.SettingsShortcut != nil {
|
if os.SettingsShortcut != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user