vaadin/vaadin-context-menu

TypeError: Cannot read property '0' of undefined

Skrikjo opened this issue · 0 comments

When context menu have no items error is showed: TypeError: Cannot read property '0' of undefined
More details from exception:

vaadin-list-mixin.html:193 Uncaught TypeError: Cannot read property '0' of undefined
    at HTMLElement.focus (vaadin-list-mixin.html:193)
    at HTMLElement._onVaadinOverlayOpen (vaadin-context-menu.html:394)
    at HTMLElement.handler (template-stamp.html:96)
    at HTMLElement.Polymer.RenderStatus.afterNextRender (vaadin-overlay.html:546)
    at callMethod (render-status.html:51)
    at runQueue (render-status.html:42)
    at render-status.html:29

Looks like in before calling child.focus() at vaadin-context-menu.html:394 check
that child.items[0] is defined missing.

How to reproduse

  1. Create context menu with no item.
  2. bind it to target
  3. right click on target
        Span contextTarget = new Span("Context menu target");
        ContextMenu menu = new ContextMenu(contextTarget);
        add(contextTarget);