reset focus on page change
This commit is contained in:
@@ -106,6 +106,7 @@ func (b *BrowsingPane) doSetPage(p Page) bool {
|
|||||||
if np, ok := p.(CanShowNowPlaying); ok {
|
if np, ok := p.(CanShowNowPlaying); ok {
|
||||||
np.OnSongChange(b.app.PlaybackManager.NowPlaying())
|
np.OnSongChange(b.app.PlaybackManager.NowPlaying())
|
||||||
}
|
}
|
||||||
|
b.pageContainer.Remove(b.curPage)
|
||||||
b.pageContainer.Objects[1] = p
|
b.pageContainer.Objects[1] = p
|
||||||
b.Refresh()
|
b.Refresh()
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -88,9 +88,12 @@ func (m *MainWindow) addNavigationButtons() {
|
|||||||
func (m *MainWindow) addShortcuts() {
|
func (m *MainWindow) addShortcuts() {
|
||||||
m.Canvas().AddShortcut(&ShortcutBack, func(_ fyne.Shortcut) {
|
m.Canvas().AddShortcut(&ShortcutBack, func(_ fyne.Shortcut) {
|
||||||
m.BrowsingPane.GoBack()
|
m.BrowsingPane.GoBack()
|
||||||
|
// TODO: reset focus only if something inside the page had focus
|
||||||
|
m.Canvas().Focus(nil)
|
||||||
})
|
})
|
||||||
m.Canvas().AddShortcut(&ShortcutForward, func(_ fyne.Shortcut) {
|
m.Canvas().AddShortcut(&ShortcutForward, func(_ fyne.Shortcut) {
|
||||||
m.BrowsingPane.GoForward()
|
m.BrowsingPane.GoForward()
|
||||||
|
m.Canvas().Focus(nil)
|
||||||
})
|
})
|
||||||
m.Canvas().AddShortcut(&ShortcutSearch, func(_ fyne.Shortcut) {
|
m.Canvas().AddShortcut(&ShortcutSearch, func(_ fyne.Shortcut) {
|
||||||
if s := m.BrowsingPane.GetSearchBarIfAny(); s != nil {
|
if s := m.BrowsingPane.GetSearchBarIfAny(); s != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user