d3-context-menu icon indicating copy to clipboard operation
d3-context-menu copied to clipboard

Cannot read property 'pageX' of null

Open rajaee-rad opened this issue 5 years ago • 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));


rajaee-rad avatar Feb 05 '20 09:02 rajaee-rad

I am also getting same issue, any solution?

vivek0460 avatar Feb 25 '20 06:02 vivek0460

This might help https://github.com/patorjk/d3-context-menu/issues/38

chakraborty-slx avatar Apr 27 '20 08:04 chakraborty-slx

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

nguyenlamlll avatar Aug 30 '20 15:08 nguyenlamlll

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?

ShiroWinG avatar Dec 09 '20 05:12 ShiroWinG

Did anybody find a solution to this?

Rudgey84 avatar Jan 20 '23 21:01 Rudgey84