patorjk/d3-context-menu

Cannot read property 'pageX' of null

Opened this issue · 5 comments

hi
using d3 v5 and reactjs and d3-context-menu
I'm receiving the following error:

TypeError: Cannot read property 'pageX' of null

import * as d3 from "d3";
import contextMenuFactory from "d3-context-menu";
 let contextMenu = contextMenuFactory(d3);
      var menu = [
        {
          title: "Item #1",
          action: function(d, i) {
            console.log("Item #1 clicked!");
            console.log("The data for this circle is: " + d);
          },
          disabled: false // optional, defaults to false
        },
        {
          title: "Item #2",
          action: function(d, i) {
            console.log("You have clicked the second item!");
            console.log("The data for this circle is: " + d);
          }
        }
      ];
      svgContextMenu.selectAll("g").on("contextmenu", contextMenu(menu));


I am also getting same issue, any solution?

This might help #38

I'm using something like this

d3.selectAll(".my_node").on('contextmenu', (d) => {
    contextMenu(menu);
});

I no longer see the property pageX error. I see one <div> and <ul> created but the context menu is empty. Probably it relates to #53

I'm using something like this

d3.selectAll(".my_node").on('contextmenu', (d) => {
    contextMenu(menu);
});

I no longer see the property pageX error. I see one <div> and <ul> created but the context menu is empty. Probably it relates to #53

I’m having the same issue, did you end up figuring out?

Did anybody find a solution to this?