You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
This issue only relates to a single bug. I will open new issues for any other problems.
Describe the bug
This applies to both modal and non-modal popups but only affects non-modal popups when they are programmatically hidden. (ie when hidden by a user tap elsewhere it has the correct behavior)
Note also that the widget IS actually unfocused. If you show the popup again the widget does not have focus, but its styling will still suggest that it does!
How to reproduce
Run the example code, show the popup, then hide it without focusing the entry. Show it again, and all is good. Now, focus the entry and hide the popup, and re-show it. The entry will appear focused without actually being focused. This is because its FocusLost isn't called when hiding the popup.
Screenshots
No response
Example code
package main
import (
"log""fyne.io/fyne/v2""fyne.io/fyne/v2/app""fyne.io/fyne/v2/container""fyne.io/fyne/v2/widget"
)
typefocusLostEntrystruct {
widget.Entry
}
funcnewFocusLostEntry() *focusLostEntry {
e:=&focusLostEntry{}
e.ExtendBaseWidget(e)
returne
}
func (e*focusLostEntry) FocusLost() {
log.Println("Focus lost")
e.Entry.FocusLost()
}
funcmain() {
app:=app.New()
win:=app.NewWindow("Popup FocusLost bug")
varpop*widget.PopUphide:=widget.NewButton("Hide", func() {
pop.Hide()
})
e:=newFocusLostEntry()
e.PlaceHolder="Focus me"pop=widget.NewModalPopUp(container.NewVBox(
widget.NewLabel("This is a modal popup"),
e,
hide,
), win.Canvas())
win.SetContent(container.NewBorder(
widget.NewLabel("This is the main window content"), nil, nil, nil,
container.NewCenter(widget.NewButton("Show", func() {
pop.Show()
})),
))
win.Resize(fyne.NewSize(400, 300))
win.ShowAndRun()
}
Fyne version
2.4.1
Go compiler version
go1.21.1
Operating system and version
macOS Ventura M2
Additional Information
No response
The text was updated successfully, but these errors were encountered:
dweymouth
changed the title
calling Hide() on a widget.PopUp does not call FocusLost() on focused widgets contained in it
[Regression] calling Hide() on a widget.PopUp does not call FocusLost() on focused widgets contained in it
Nov 6, 2023
dweymouth
added a commit
to dweymouth/fyne
that referenced
this issue
Nov 6, 2023
Checklist
Describe the bug
This applies to both modal and non-modal popups but only affects non-modal popups when they are programmatically hidden. (ie when hidden by a user tap elsewhere it has the correct behavior)
Note also that the widget IS actually unfocused. If you show the popup again the widget does not have focus, but its styling will still suggest that it does!
How to reproduce
Run the example code, show the popup, then hide it without focusing the entry. Show it again, and all is good. Now, focus the entry and hide the popup, and re-show it. The entry will appear focused without actually being focused. This is because its FocusLost isn't called when hiding the popup.
Screenshots
No response
Example code
Fyne version
2.4.1
Go compiler version
go1.21.1
Operating system and version
macOS Ventura M2
Additional Information
No response
The text was updated successfully, but these errors were encountered: