Hi,
I encountered some kind of strange behaviour with the new component PopOver. It gets like duplicated on some conditions I could not determine.
Description of the system surrounding the component:
I have a view with an TreeGrid as a navigation component. When I select items on there, most of the components gets switched out for the components of the selection. One of the components, that (mostly) stay, is an Icon with a PopOver. The PopOver holds a description of the other components of the view at the time. To do that the text in the PopOver gets changed, when a new item is selected in the TreeGrid.
Description of the PopOver initialisation:
The PopOver and the icon are components of the same java file. I initialise it with the VaadinIcon which should hold the PopOver. The PopOver contains a VerticalLayout to get padding etc. I set it to open on hover, give it a delay time for the hover to activate, define, that it should close on outside click and set the target to my icon component.
In the VerticalLayout is a span which holds the text I want to display. The text gets changed over a public method. Also, the text in HTML, so I set it with “this.text.getElement().setProperty(’innerHTML’, content);”.
Description of the problem:
When I open the view an select an item from the TreeGrid all components are displayed correctly. But when I hove above the icon two PopOvers open. One is the correct one with the desired text. One is completely empty.
Results of testing:
The empty PopOver is the version, before the text was set. So, if set text to my span in the initialisation this text is display in the PopOver.
My constructor is only called once in the whole application, so there is no way I could have added another PopOver to the icon. The only method which is called multiple times is the one to set the text of the span.
I found a workaround: When I set the target not at initialisation, but when the texts get exchanged, the empty PopOver does not show up.
I saw, that there was an Issue (now closed) for a race condition to the PopOver, but the use of the lasts version of Vaadin (24.5.7) did not resolve the problem.
I have other views with PopOvers that have changing content, that doesn’t have this kind of problem.
When I don’t set text to the span after the initialisation, it only shows one PopOver. I also tried to comment out all lines, that were not needed, but the problem persisted.
My guess is that it has something to do with the attachment and detachment of the icon, because if no TreeGrid item is selected, only the TreeGrid is shown. But is only a guess and I could not prove it.