Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Point to Element" scrolls to wrong position in iframes #262

Open
jamadam opened this issue Apr 15, 2019 · 1 comment
Open

"Point to Element" scrolls to wrong position in iframes #262

jamadam opened this issue Apr 15, 2019 · 1 comment
Assignees

Comments

@jamadam
Copy link
Contributor

jamadam commented Apr 15, 2019

Firefox 66.0.2
Google Chrome 73.0.3683.103

Procedure to reproduce

  1. Open test1.html below.
  2. Open HTML CodeSniffer by bookmarklet.
  3. Open 1st issue. (and click on "Point to Element" to try again)

Expected Behavior

The icon points to the text "line 1" and the scrolltop of iframe body is 0.

Actual Behavior

The icon points to the text "line 1" but the scrolltop of iframe body is 121.

Other information

It seems padding-top:200px; has something to do with the issue.

test1.html

<html lang="ja">
    <title>test1</title>
    <style>
        body {
            padding-top:200px;
        }
        iframe {
            width:100%;
            height:300px;
        }
    </style>
    <body>
        <iframe src="./test2.html" title="Main Content"></iframe>
    </body>
</html>

test2.html

<html lang="ja">
    <title>test2</title>
    <style>
        body {
            background-color:#aaa;
            color:#bbb;
        }
        * {
            box-sizing:border-box;
            font-size:20px;
        }
    </style>
    <body>
        <strong>line 1</strong>
        <br><strong>line 2</strong>
        <br><strong>line 3</strong>
        <br><strong>line 4</strong>
        <br><strong>line 5</strong>
        <br><strong>line 6</strong>
        <br><strong>line 7</strong>
        <br><strong>line 8</strong>
        <br><strong>line 9</strong>
        <br><strong>line 11</strong>
        <br><strong>line 12</strong>
        <br><strong>line 13</strong>
        <br><strong>line 14</strong>
        <br><strong>line 15</strong>
        <br><strong>line 16</strong>
        <br><strong>line 17</strong>
        <br><strong>line 18</strong>
        <br><strong>line 19</strong>
        <br><strong>line 20</strong>
    </body>
</html>
@ironikart
Copy link
Contributor

I can replicate this. The element positioning math needs to be reviewed so that it works correctly for content inside iframes (Roughly in Auditor/HTMLCSAuditor.js line 1978 where targetY is calculated).

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

No branches or pull requests

2 participants