<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>232996</bug_id>
          
          <creation_ts>2021-11-11 06:38:21 -0800</creation_ts>
          <short_desc>rect returns wrong coordinates after calling scrollIntoView</short_desc>
          <delta_ts>2021-11-15 04:25:40 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebDriver</component>
          <version>Safari 14</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>macOS 11</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>sebastian.klaar</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bburg</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1814007</commentid>
    <comment_count>0</comment_count>
    <who name="">sebastian.klaar</who>
    <bug_when>2021-11-11 06:38:21 -0800</bug_when>
    <thetext>We&apos;re using webdriverio to execute automated tests on Safari.

The w3c command &quot;scrollIntoView&quot; causes the following command to return wrong coordinates:
/session/:sessionId/element/:elementId/rect&quot;: {
&quot;GET&quot;: {
&quot;command&quot;: &quot;getElementRect&quot;,
&quot;description&quot;: &quot;The Get Element Rect command returns the dimensions and coordinates of the given web element.&quot;,
&quot;ref&quot;: &quot;https://w3c.github.io/webdriver/#dfn-get-element-rect&quot;,
&quot;variables&quot;: [{
&quot;name&quot;: &quot;elementId&quot;,
&quot;description&quot;: &quot;the id of an element returned in a previous call to Find Element(s)&quot;
}],
&quot;parameters&quot;: [],
&quot;returns&quot;: {
&quot;type&quot;: &quot;Object&quot;,
&quot;name&quot;: &quot;elementRect&quot;,
&quot;description&quot;: &quot;A JSON object representing the position and bounding rect of the element.&quot;
}
}
}, 

The returned values are off by the amount of scroll range. According to the w3c specification &quot;rect&quot; should return coordinates relative to the browsing context and not to the viewport.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1814008</commentid>
    <comment_count>1</comment_count>
    <who name="">sebastian.klaar</who>
    <bug_when>2021-11-11 06:38:43 -0800</bug_when>
    <thetext>reference: https://feedbackassistant.apple.com/feedback/9381783</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1815017</commentid>
    <comment_count>2</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2021-11-15 04:25:40 -0800</bug_when>
    <thetext>rdar://80958449

&gt; According to the w3c specification &quot;rect&quot; should return coordinates relative to the browsing context

No, it&apos;s &quot;relative to the current browsing context’s document element&quot;

WPT has some failing tests, though not scrolling first: https://wpt.fyi/results/webdriver/tests/get_element_rect/get.py?label=experimental&amp;label=master&amp;aligned</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>