Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8087905

[WebView] Click handler not being called for path elements in svg on stroke regions.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 7u55, 8u5
    • javafx
    • None
    • web

      Consider the following html,

      <!doctype html>
      <html>
      <head>
      <script type="text/javascript">
          function onSVGLoad () {
              var elements = document.getElementsByTagName('path');
              for (var index = 0; index < elements.length; index = index + 1) {
                  elements[index].addEventListener('click', function () {
                      alert('clicked');
                  });
              }
          };
      </script>
      </head>
      <body onload="onSVGLoad();">
      <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" height="768" viewBox="0,0 1024,768" width="1024">
      <path stroke="blue" stroke-width="5" fill="white" d="M500,400L500,700L800,700L800,400L500,400" />
      <path stroke="red" stroke-width="5" fill="white" d="M600,200v200" />
      <path stroke="red" stroke-width="5" fill="white" d="M700,200v200" />
      </svg>
      </body>
      </html>

      On any modern browser, you can click any of the visible elements and you would get an alert. If you load the same file in a WebView, you get an alert only on the box-like path. It looks like the click event is raised only on the fill region.

      Shouldn't the behaviour be consistent?

            ghb Guru Hb (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: