Skip to content

app.juster.fi - Vertical line on the graph has different position than the mouse cursor #94500

Closed

Description

@webcompat-bot

URL: https://app.juster.fi/explore

Browser / Version: Firefox 95.0
Operating System: Mac OS X 10.15
Tested Another Browser: Yes Chrome

Problem type: Something else
Description: Might be JavaScript issue
Steps to Reproduce:
Hold mouse on any graph on the "Top markets" section.
You'll notice that the vertical line in the graph is not the same position as your mouse position.

I think it's might be JavaScript or CSS support-related issue.

Please see the screen record here if it's not clearly explained.
https://www.dropbox.com/s/dtorfrcqdx7nffs/Screen%20Recording%202021-11-25%20at%2001.12.23.mp4?dl=0

Browser Configuration
  • None

From webcompat.com with ❤️

Activity

  1. added
    action-needsmoderation
    on Nov 24, 2021
  2. added this to the needstriage milestone on Nov 24, 2021
  3. added
    browser-fixme
    on Nov 24, 2021
  4. changed the title [-]In the moderation queue.[/-] [+]app.juster.fi - see bug description[/+] on Nov 25, 2021
  5. added
    engine-gecko
    and removed
    browser-fixme
    action-needsmoderation
    on Nov 25, 2021
  6. added
    os-mac
    on Nov 25, 2021
  7. changed the title [-]app.juster.fi - see bug description[/-] [+]app.juster.fi - Vertical line on the graph has different poistion than the mouse cursor[/+] on Nov 25, 2021
  8. added
    severity-important
    on Nov 25, 2021
  9. softvision-oana-arbuzov commented on Nov 25, 2021

    @softvision-oana-arbuzov
    Member

    Thanks for the report, but I'm not able to reproduce the issue. The mouse cursor
    image

    Note: The issue is not reproducible on Chrome.
    image

    Tested with:
    Browser / Version: Firefox Nightly 96.0a1 (2021-11-24)
    Operating System: Windows 10 Pro

    Moving to Needsdiagnosis for further investigation.

  10. changed the title [-]app.juster.fi - Vertical line on the graph has different poistion than the mouse cursor[/-] [+]app.juster.fi - Vertical line on the graph has different position than the mouse cursor[/+] on Nov 25, 2021
  11. karlcow commented on Nov 29, 2021

    @karlcow
    Member

    Same issue is happening in Safari.
    The line position is computed in https://app.juster.fi/js/event~explore.38a750d3.js:formatted

    it adds a line element on mousemove.

              Object(c['k']) ('div', {
                id: 'chart_'.concat(e.symbol.id),
                onMousemove: t[1] || (t[1] = function () {
                  return e.onMouseMove && e.onMouseMove.apply(e, arguments)
                }),
                onMouseleave: t[2] || (t[2] = function () {
                  return e.onMouseLeave && e.onMouseLeave.apply(e, arguments)
                })
              }, null, 40, [
                'id'
              ])
              d.append('line').attr('x1', t).attr('x2', t).attr('y1', 140).attr('y2', 0).attr('stroke', 'rgba(255,255,255, 0.5)').attr('stroke-width', 2).attr('stroke-dasharray', '2 8')

    in

            u = function (e) {
              var t = e.layerX,
              c = Object(k['a']) ({
                quotes: r.value
              }),
              n = p['f']().domain(p['a'](c, (function (e) {
                return e.date
              }))).range([0,
              500]),
              l = n.invert(t),
              s = c.map((function (e) {
                return Math.abs(e.date - l)
              })),
              i = s.indexOf(Math.min.apply(Math, Object(m['a']) (s)));
              b.value = c[i];
              var o = p['h']('#chart_'.concat(a.value.id, ' > svg > line'));
              o.remove();
              var d = p['g']('#chart_'.concat(a.value.id, ' > svg'));
              d.append('line').attr('x1', t).attr('x2', t).attr('y1', 140).attr('y2', 0).attr('stroke', 'rgba(255,255,255, 0.5)').attr('stroke-width', 2).attr('stroke-dasharray', '2 8')
            },

    Initially I thought it was due to a bug on e.layerX where e is mousemove. So I replaced layerX with clientX in the code but there was the same issue. So I wondered about the size of the box.

    <div class="SymbolCard_chart_1pv8h">
      <div id="chart_5"><svg width="500" height="140">
          <g transform="translate(0,20)">
            <path fill="none" stroke="#e05c43" stroke-width="1.5" d="M0,70.5329024…80,15.150252868650282"></path>
            <circle cx="480" cy="15.150252868650282" r="2" fill="#fff"></circle>
            <circle id="animated_circle" cx="480" cy="15.150252868650282" fill="rgba(255,255,255,0.07)" stroke="rgba(255,255,255, 0.5)" stroke-width="2px">
              <animate id="ac1" attributeType="SVG" attributeName="r" begin="1s;ac1.end+2s" dur="1.5s" from="1%" to="10%"></animate>
              <animate id="ac2" attributeType="CSS" attributeName="stroke-width" begin="1s;ac2.end+2s" dur="1.5s" from="2px" to="0px"></animate>
              <animate id="ac3" attributeType="CSS" attributeName="opacity" begin="1s;ac3.end+2s" dur="1.5s" from="1" to="0"></animate>
            </circle>
          </g>
        </svg></div>
    </div>

    in my current screen:

    .SymbolCard_chart_1pv8h is defined as 344px, but #chart5 is 500px wide. mousemove is listening the layer on chart5

    Ah!

    • if I pull out #chart5 at the level of the body I get the right behavior.
    • if I put .SymbolCard_chart_1pv8h at the level of the body I get the wrong behavior.

    But I wonder if it's because the layer is redrawn or not. It's not perfect either and seems a bit random the gap in between the position of the line and the position of the cursor.

    @emilio is it possible the initial position of mousemove depends on the rendering phase in a complex layout? (multiple grid and flexbox nested).

  12. emilio commented on Nov 29, 2021

    @emilio

    @karlcow seems unlikely.

    This is just about what point we return layerX relative to. The page seems to want the coordinates relative to the SVG, but that's not necessarily the spec behavior. Since #chart_5 is not a "layer" either (an abspos containing block), we return the coordinates relative to the parent, which is moved by a few pixels.

    Here's a reduced test-case: https://crisal.io/tmp/layer-point-svg.html

    <!doctype html>
    Does the circle follow the mouse?
    <svg width=500 height=500>
      <rect fill=blue x=0 y=0 width=500 height=500></rect>
      <circle fill=red cx=0 cy=0 r=10></circle>
    </svg>
    <script>
      let svg = document.querySelector("svg");
      let circle = document.querySelector("circle");
      svg.addEventListener("mousemove", function(e) {
        circle.setAttribute("cx", e.layerX);
        circle.setAttribute("cy", e.layerY);
      });
    </script>

    I think including outer svg as a "layer" makes some amount of sense. I've pinged folks in w3c/pointerevents#626 anyways though...

  13. emilio commented on Nov 29, 2021

    @emilio

    I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1743402 with a patch that would fix this site, though probably we want some consensus on what a "layer" for this purpose is, so I probably won't land it right away.

    The site can fix this trivially adding position: relative to the id="chart_*" elements or the <svg> itself. @karlcow can you contact them?

  14. emilio commented on Nov 29, 2021

    @emilio

    Ah, I commented on juster-finance/juster-app#15

  15. emilio commented on Nov 29, 2021

    @emilio
  16. emilio commented on Nov 30, 2021

    @emilio

    Fixed by juster-finance/juster-app#25, @karlcow can we close this?

  17. modified the milestones: needsdiagnosis, fixed on Dec 1, 2021
  18. karlcow commented on Dec 1, 2021

    @karlcow
    Member

    thanks

  19. removed their assignment
    on Dec 6, 2021
  20. softvision-oana-arbuzov commented on Dec 6, 2021

    @softvision-oana-arbuzov
    Member

    I can confirm it works now.
    image

    Tested with:
    Browser / Version: Firefox Nightly 96.0a1 (2021-12-04), Firefox Nightly 100.
    Operating System: Windows 10 Pro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    browser-firefoxbrowser-safariengine-geckoos-macpriority-normalseverity-important

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions