question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

event is null when used with react

See original GitHub issue

Hi, thx for your work. I really like the look and feel of the annotations and want to use them in my projects. I usually work with react with webpack and babel. But this seems to lead to some problems concerning the editable mode. When I try to drag an element (clicking on a circle) i get the following error message:

drag.js?71be:10 Uncaught TypeError: Cannot read property 'button' of null at SVGCircleElement.defaultFilter (eval at <anonymous> (bundle.js:5531), <anonymous>:16:70) at SVGCircleElement.mousedowned (eval at <anonymous> (bundle.js:5531), <anonymous>:47:32) at SVGCircleElement.eval (eval at <anonymous> (bundle.js:2179), <anonymous>:29:16)

Looking at the file drag.js in d3-drag/src/ I find this: function defaultFilter() { return !event.button; }

The issue seems to be related to these issues here:

But I decided to still write this here because others might run into the same problem. I have not found a way to get the editable mode running. For now I just configure the annotations by hand in the code. If anyone has an idea how I could get it to work, I’d appreciate it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
samal-rasmussencommented, Nov 26, 2018

For me it was the same reason as this: https://github.com/d3/d3-selection/issues/185#issuecomment-419474845

I’m using Yarn and it had added two versions of d3-select. I manually removed one from yarn.lock and then it worked.

1reaction
susielucommented, Nov 20, 2017

My recommendation is to use react-annotation for this use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React: this is null in event handler - Stack Overflow
You need set this for submit method because now this is undefined , for this operation you can use .bind onSubmit={ this.submit.bind(this) }....
Read more >
[Solved]-React: this is null in event handler-Reactjs
This will create a function which is an object in javascript and it will take some memory and is now residing inside your...
Read more >
null - JavaScript - MDN Web Docs - Mozilla
The null value represents the intentional absence of any object value. It is one of JavaScript's primitive values and is treated as falsy...
Read more >
Forms - React
Controlled Input Null Value. Specifying the value prop on a controlled component prevents the user from changing the input unless you desire so....
Read more >
Why You Keep Getting “Null” After Running setState() in React
state right after calling setState() a potential pitfall. Instead, use componentDidUpdate or a setState callback ( setState(updater, callback) ), either of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found