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

[Popover] OpenedChangeEvent should not trigger on view initialization #6961

Open
ma99koch opened this issue Dec 18, 2024 · 0 comments
Open

Comments

@ma99koch
Copy link

Description

When adding a popover to a view, an OpenedChangeEvent for closing the Popover is triggered on view initialization.

Not sure if this is expected behaviour - for me it was not ;)

Expected outcome

OpenedChangeListener of a popover should not be executed when view opens and popover is not visible.

Minimal reproducible example

@Route("popover-opened-listener")
@AnonymousAllowed
public class PopoverOpenedListener extends Div {
	
	private static final long serialVersionUID = 1L;

	public PopoverOpenedListener() {
		Span text = new Span("Click me");
		Popover popover = new Popover(new Div("Popover"));
		popover.setTarget(text);

		popover.addOpenedChangeListener(e -> {
			System.err.println("Popover opened: " + e.isOpened());
		});

		add(text);
	}
}

Output on opening view:

Popover opened: false

Steps to reproduce

  1. Create and open view from snippet
  2. See console for the output

Environment

Vaadin version(s): 24.5.8 (flow 24.5.9)
OS: Ubuntu 24.04

Browsers

Issue is not browser related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants