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

Clicking on empty part of widget.List does not unfocus other widgets #4770

Open
2 tasks done
Jacalz opened this issue Apr 6, 2024 · 0 comments
Open
2 tasks done

Clicking on empty part of widget.List does not unfocus other widgets #4770

Jacalz opened this issue Apr 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Jacalz
Copy link
Member

Jacalz commented Apr 6, 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

I noticed in Rymdport (see corresponding issue at Jacalz/rymdport#142) that it wasn't possible to unfocus an Entry. I thought that it related to my extended entry (with accepts tabs instead of moving focus along) breaking something but I narrowed it down to widget.List not unfocusing other widgets in the case of it receiving a click that doesn't select any items.

How to reproduce

  1. Start the example code below.
  2. Focus the entry.
  3. Try to click in between the list item and notice that the entry stays focused.
  4. Now click the text at the bottom of the window and notice that it does unfocus correctly.

Screenshots

list-unfocus-other-widgets.webm

Example code

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
)

func main() {
	a := app.New()
	w := a.NewWindow("Hello")

	unfocus := widget.NewLabel("Try to click in an empty part of the list or on this text to unfocus!")
	focus := &widget.Entry{PlaceHolder: "Focus me first!"}
	list := widget.NewList(func() int { return 1 }, func() fyne.CanvasObject { return widget.NewLabel("Item") }, func(lii widget.ListItemID, co fyne.CanvasObject) {})
	w.SetContent(container.NewBorder(focus, unfocus, nil, nil, list))
	w.Resize(w.Canvas().Size().AddWidthHeight(0, 100))

	w.ShowAndRun()
}

Fyne version

v2.4.4 and develop as of dc61414

Go compiler version

1.21.8

Operating system and version

Fedora Silverblue 39

Additional Information

No response

@Jacalz Jacalz added the bug Something isn't working label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant