Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abnormal Form Widget Entry Validation Behavior on Paste in Fyne 2.5.0 #5058

Closed
2 tasks done
zhironghsu opened this issue Aug 8, 2024 · 1 comment · Fixed by #5145
Closed
2 tasks done

Abnormal Form Widget Entry Validation Behavior on Paste in Fyne 2.5.0 #5058

zhironghsu opened this issue Aug 8, 2024 · 1 comment · Fixed by #5145
Labels
blocker Items that would block a forthcoming release bug Something isn't working

Comments

@zhironghsu
Copy link

zhironghsu commented Aug 8, 2024

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

  1. Use the provided sample code.
  2. Run the application in Fyne 2.5.0.
  3. Paste any text into the Entry widget from the clipboard.
  4. 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.
fyne245

Fyne 2.5.0: Validation behaves abnormally and is not triggered when text is pasted.
fyne250

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

@zhironghsu zhironghsu added the unverified A bug that has been reported but not verified label Aug 8, 2024
@zhironghsu zhironghsu changed the title Form Widget Entry Validation Not Triggering on Paste in Fyne 2.5.0 Abnormal Form Widget Entry Validation Behavior on Paste in Fyne 2.5.0 Aug 8, 2024
@andydotxyz andydotxyz added this to the E fixes (v2.5.x) milestone Aug 9, 2024
@andydotxyz andydotxyz added bug Something isn't working blocker Items that would block a forthcoming release and removed unverified A bug that has been reported but not verified labels Aug 9, 2024
pierrec pushed a commit to pierrec/fyne that referenced this issue Sep 14, 2024
pierrec pushed a commit to pierrec/fyne that referenced this issue Sep 14, 2024
@andydotxyz
Copy link
Member

Fixed thanks to @pierrec, on develop and will pick to release branch

pierrec pushed a commit to pierrec/fyne that referenced this issue Oct 1, 2024
andydotxyz pushed a commit to andydotxyz/fyne that referenced this issue Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Items that would block a forthcoming release bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants