Click event on SVG <use> element firing on <defs> -> <use>

Issue #15727705 • Assigned to Bogdan B.

Details

Author
Porter M.
Created
Jan 31, 2018
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
16.16299
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Steps to reproduce


  1. Load the attached “eventIssue.html” open and open developer tools.
  2. Click on SVG element.

As you can see, event firing on <g id="italian-flag"> inside <defs>. Not inside the <g id="svg-group">.

Issue reproduced on:

  • Edge/16.16299

Event.target.parentNode works fine on:

  • Chrome
  • Opera
  • IE
  • Edge 15
  • Firefox
  • Safari

Attachments

1 attachment

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

    Changed Assigned To to “Travis L.”

    Changed Assigned To to “Bogdan B.”

  • Thanks for the report. IE and Edge used to have problems with hit-testing for USE elements pointing to external svg files, and I guess this new issue is the result of the changes that have been done to fix that. 

    As you noted, we still fire the click event on the <use> element, but we also fire it on the elements that have been clicked in the other document if they are in a scriptable context. As it turns out, this changes the eventTarget in case these elements are actually in the same document (USE elements pointing to internal svg nodes). 

    You can use event.currentTarget if you need the element on which the event is currently being fired. It is not clear to me our behavior here is a bug, but we will probably try to match other browsers if we see websites being affected.

  • @Francois R. I cant use "event.currentTarget", because it returns me "undefiend". How i can get parentNode?

You need to sign in to your Microsoft account to add a comment.

Sign in