Open Bug 1597769 Opened 6 years ago Updated 7 months ago

scroll-margin is not respected when typing into an offscreen textarea

Categories

(Core :: Layout: Scrolling and Overflow, defect, P3)

70 Branch
defect

Tracking

()

People

(Reporter: sammy, Unassigned)

Details

Attachments

(2 files)

Attached file bug-test.html —

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

  1. Open the attached file (bug-test.html)
  2. Scroll to the bottom of the page
  3. Click the scrollIntoView() button, note that the fixed div is not obscuring the textarea
  4. Click on the textarea to focus it
  5. Scroll to the bottom of the page so that the textarea is offscreen
  6. Type any text to autoscroll the viewport

Actual results:

After hitting the scrollIntoView button, the viewport scrolled up far enough that the fixed div did not obscure the textarea. After typing into the textarea, the viewport did not auto-scroll far enough, and the fixed div covered up the typing area.

Expected results:

The viewport should have auto-scrolled far enough that there was (scroll-margin-top) worth of space above the typing area.

Component: Untriaged → Layout
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Component: Layout → Layout: Scrolling and Overflow
Ever confirmed: true

Seems like bug 1534070 landed with (the equivalent to) this line.

Hiro, seems there are a bunch of callers that use that flag. Is there really any case where we want not to honor scroll-margin and scroll-padding?

I think we should ~always honor them.

Flags: needinfo?(hikezoe.birchill)

Basically what I did for scroll-{margin,padding} was to ignore them for internal usages (i.e. not web-exposed features). But yeah in this case we should honor them. And it is/was not clear to me whether all the places should honor them or not. So to me, a way I can think of is bug-report-driven just like this bug. And IIRC, Masayuki gave me a comment that he is reluctant to honor them in all places blindly (and I agreed with him).

Flags: needinfo?(hikezoe.birchill)
Priority: -- → P3
Severity: normal → S3

Chrome matches our behavior, FWIW.

Safari gives results that happen to look nicer for this testcase -- they scroll all the way back to the top (so that there's some blue visible between the textarea and the transparent div -- but they do that regardless of scroll-margin-top.

Here's a modified testcase that I used to prod at the Safari/WebKit behavior that I mentioned in comment 3.

This illustrates that, when you start typing into a line of text in the textarea:
(A) if the line that you're typing is party offscreen, then Safari scrolls enough to move that line into the viewport. [This matches Chrome/Firefox.]
(B) if the line that you're typing into is entirely offscreen, then Safari scrolls to center the line in the viewport (as best as it can -- e.g. in the original testcase, it can't actually center the line because it runs up against the top of the page and can't scroll any more) [This is different from Chrome/Firefox -- Chrome/Firefox only scroll far enough to move the line into the viewport, as in (A).]
(C) Safari doesn't take scroll-margin into account for this process at all. [This matches Chrome/Firefox.]

So: bottom line, the request in this bug (to respect scroll-margin) seems reasonable, but it's worth noting that no browser currently has the requested behavior.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: