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

Android: Key presses may cause doubled events #5259

Open
2 tasks done
pjanx opened this issue Nov 12, 2024 · 5 comments
Open
2 tasks done

Android: Key presses may cause doubled events #5259

pjanx opened this issue Nov 12, 2024 · 5 comments
Labels
Keyboard Items for keyboard control unverified A bug that has been reported but not verified

Comments

@pjanx
Copy link

pjanx commented Nov 12, 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

With different virtual keyboards (Samsung Keyboard, Unexpected Keyboard, however Microsoft SwiftKey is fine) and also with an attached hardware keyboard, I get doubled key presses. The observation with a hardware keyboard is such that the app then acts on both pressing and releasing the keys.

I've never seen it with another app. I couldn't manage to reproduce it in an emulator.

How to reproduce

Switch around virtual keyboards, type into an Entry, and also use the Backspace key.

Screenshots

No response

Example code

package main

import (
	"net"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/dialog"
	"fyne.io/fyne/v2/driver/mobile"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Bugs")
	w.Resize(fyne.NewSize(640, 480))
	w.SetContent(widget.NewMultiLineEntry())

	connectAddress := widget.NewEntry()
	connectAddress.SetPlaceHolder("host:port")
	connectAddress.Validator = func(text string) error {
		_, _, err := net.SplitHostPort(text)
		return err
	}
	connectAddress.SetText(string([]byte{3, 2, 1, 65, 66, 67, ':', '1'}))
	connectAddress.TypedKey(&fyne.KeyEvent{Name: fyne.KeyPageDown})

	var wConnect *dialog.FormDialog
	wConnect = dialog.NewForm("Connect to relay", "Connect", "Exit",
		[]*widget.FormItem{
			{Text: "Address:", Widget: connectAddress},
		}, func(ok bool) {
			if ok {
			} else if _, ok := a.Driver().(mobile.Driver); ok {
				wConnect.Show()
			} else {
				a.Quit()
			}
		}, w)
	wConnect.Show()
	w.ShowAndRun()
}

Fyne version

2.5.2

Go compiler version

1.23.2

Operating system and version

Android 13 One UI 5.1

Additional Information

No response

@pjanx pjanx added the unverified A bug that has been reported but not verified label Nov 12, 2024
@andydotxyz
Copy link
Member

andydotxyz commented Nov 15, 2024

Which soft keyboard did you have loaded?

Is it all keys or just some? (I.e. characters / numbers / control could all behave differently)

@pjanx
Copy link
Author

pjanx commented Nov 16, 2024

It's a bit wild:

  • Unexpected Keyboard: virtual Backspace, everything but numbers on a HW keyboard (key down, key up),
  • Samsung Keyboard: virtual Backspace, everything but numbers on a HW keyboard (key down, key up),
  • Microsoft SwiftKey: works as expected, also on a HW keyboard.

@andydotxyz
Copy link
Member

Just for clarity "virtual Backspace, everything but numbers" means that all duplicate except the number keys yes?
So to put it another way "duplicates on virtual keyboard and all keys on hardware except numbers"?

What is confusing me is that a hardware keyboard changes behaviour based on the loaded virtual keyboard. There must be something about android events that changes the interpretation based on what software is currently connected to the input field?...

@andydotxyz
Copy link
Member

Related and possibly duplicate: #2774

@andydotxyz andydotxyz added the Keyboard Items for keyboard control label Nov 19, 2024
@andydotxyz andydotxyz added this to the E fixes (v2.5.x) milestone Nov 19, 2024
@pjanx
Copy link
Author

pjanx commented Nov 19, 2024

Ah, yeah, I went through all issues but failed to notice some. Feel free to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Keyboard Items for keyboard control unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

2 participants