Closed
Description
Checklist
- 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
In Fyne version 2.5.0, the validation function for the Entry widget within a Form widget behaves abnormally when text is pasted directly from the clipboard. The same code works as expected in version 2.4.5, where the validation is triggered correctly upon pasting text.
How to reproduce
- Use the provided sample code.
- Run the application in Fyne 2.5.0.
- Paste any text into the Entry widget from the clipboard.
- Observe that the validation function is not triggered, allowing the form to proceed with potentially invalid input.
Screenshots
I have attached two GIFs demonstrating the issue:
Fyne 2.4.5: Validation behaves normally and is triggered correctly when text is pasted into the Entry.
Fyne 2.5.0: Validation behaves abnormally and is not triggered when text is pasted.
Example code
package main
import (
"errors"
"log"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
myApp := app.New()
myWindow := myApp.NewWindow("Form Widget")
entry := widget.NewEntry()
entry.Validator = func(s string) error {
if len(s) == 0 {
return errors.New("entry cannot be empty")
}
return nil
}
form := &widget.Form{
Items: []*widget.FormItem{ // we can specify items in the constructor
{Text: "Entry", Widget: entry}},
OnSubmit: func() { // optional, handle form submission
log.Println("Form submitted:", entry.Text)
},
}
myWindow.SetContent(form)
myWindow.Resize(fyne.NewSize(300, 50))
myWindow.ShowAndRun()
}
Fyne version
2.5.0
Go compiler version
1.20.7
Operating system and version
Windows 10 19045.4651
Additional Information
No response
Activity