React: Click event's don't bubble outside SVG

Created on 10 May 2014  路  4Comments  路  Source: facebook/react

Im doing something like:

<button type="button" onClick={this.toggle}>
  {this.props.label}
</button>

If this.props.label is a div, span or some text, clicking on it triggers this.toggle. However, if this.props.label is an svg then onClick never gets triggered.

Most helpful comment

I had the same problem. A little CSS solved it for me:

svg {
    pointer-events: none;
}

All 4 comments

Do you have a repro? (jsfiddle?)

I can't repro this:

http://jsbin.com/ditulapo/1/edit

I had the same problem. A little CSS solved it for me:

svg {
    pointer-events: none;
}

@mattweb +1

Was this page helpful?
0 / 5 - 0 ratings