Hi Gerrit, made quick example: tooltip sometimes does not appear on element

Hi Gerrit, made quick example: tooltip sometimes does not appear on element after being showed:
Thanks!

<java.version>1.8</java.version>
<vaadin.version>14.7.2</vaadin.version>

@Route
public class MainView extends VerticalLayout {
    
    public MainView() {
        for (int i = 0; i < 10; i++) {
            Button myButton = new MyButton();
            Button show = new Button("Show", e -> myButton.setVisible(true));
            add(new HorizontalLayout(show, myButton));
        }
    }
    
    private static class MyButton extends Button implements HasTooltip {
        public MyButton() {
            setIcon(VaadinIcon.VAADIN_H.create());
            setTooltip("Tooltip");
            setVisible(false);
        }
    }
}

Hi,

I created an [issue]
(https://gitlab.com/gsedlacz/tooltips4vaadin/-/issues/40) for that.

Does the tooltip appear after a short period of time?
I have’nt checked it yet.

Best Regards

thx
You can see how it works in Chrome with F12 - Network tab
Once the page is loaded, 2-5 seconds later all visible tooltips at this moment will be ok-inited. Invisible will be broken until the page is reloaded.

The issue arises because the non visible component receives a DOM element (and therefore triggers its lifecycle hooks) but does not reflect its attributes.

Im looking into workarounds but it appears to be problematic atm.

Do you know of any hooks related to the visibility of a component?
Maybe Im blind :)

Best Regards

Better late than never … I found a solution to fix the hidden item problem.

If you spot any problems regarding this issue please comment them over here:
https://gitlab.com/gsedlacz/tooltips4vaadin/-/issues/40

Best Regards

Works perfect! ty and happy new year)