henrikerola / PopupButton

Vaadin Add-on
http://vaadin.com/addon/popupbutton
7 stars 24 forks source link

Uncaucht TypeError when a PopupButton is attached to the Ui and user clicks on a SVG #24

Closed Wnt closed 9 years ago

Wnt commented 10 years ago

Using add-on version 2.4.1

Online demo: http://jonni.jelastic.servint.net/PopupButtonSvgBug/?debug

Minimal test UI:

package com.example.popupbutton_bug;

import javax.servlet.annotation.WebServlet;

import org.vaadin.hene.popupbutton.PopupButton;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.Page;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Label;
import com.vaadin.ui.Notification;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

@SuppressWarnings("serial")
@Theme("popupbutton_bug")
public class Popupbutton_bugUI extends UI {

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = false, ui = Popupbutton_bugUI.class, widgetset = "com.example.popupbutton_bug.widgetset.Popupbutton_bugWidgetset")
    public static class Servlet extends VaadinServlet {
    }

    @Override
    protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);

        Label label = new Label(
                "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"320\" version=\"1.1\" height=\"200\"></svg>");
        label.setContentMode(ContentMode.HTML);
        Window window = new Window("Click on the window content!", label);

        // Position the window
        Page page = UI.getCurrent().getPage();
        window.setPositionX(page.getBrowserWindowWidth() / 2 - 160);
        window.setPositionY(page.getBrowserWindowHeight() / 2 - 100);
        UI.getCurrent().addWindow(window);

        PopupButton popupButton = new PopupButton("PopupButton");
        layout.addComponent(popupButton);

        Notification
                .show("Run with ?debug and click on the window content to trigger the client side exception!");
    }

}