Last Comment Bug 780345 - Page down scrolls too far on pages with fixed header elements (page size is miscalculated)
: Page down scrolls too far on pages with fixed header elements (page size is m...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Layout (show other bugs)
: Trunk
: All All
: -- normal with 2 votes (vote)
: mozilla17
Assigned To: Robert O'Callahan (:roc) (Exited; email my personal email if necessary)
:
Mentors:
Depends on: 1225201 1081272 1224307
Blocks: 830479
  Show dependency treegraph
 
Reported: 2012-08-03 20:18 PDT by Akkana Peck
Modified: 2015-11-16 13:55 PST (History)
10 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix (7.26 KB, patch)
2012-08-05 21:37 PDT, Robert O'Callahan (:roc) (Exited; email my personal email if necessary)
tnikkel: review+
Details | Diff | Splinter Review

Description Akkana Peck 2012-08-03 20:18:36 PDT
Pages with position:fixed banners/headers are all the rage these days. But when I try to read content inside one of these pages and hit Page Down or Spacebar, firefox calculates the page length relative to the whole browser window, not just the part visible underneath the position:fixed header. So it scrolls too much, and the first few lines of the next page end up hidden, and I have to hit up-arrow two or three times after every Page Down.

For instance, go to
http://www.raspberrypi.org/phpBB3/viewtopic.php?t=12323&p=132085
(or any other page in that forum), note the last line visible, and hit Page Down. Now hit up-arrow a couple of times and noticed that there were several lines that got skipped.

I checked chromium and it does the right thing (only scrolls the visible part of the page) so I don't think it's a bug in the page (and I'm seeing this on lots of different sites). But of course I don't want to use chromium, I want to use firefox. :) It might be a regression -- I never used to see this, but maybe it's just that these fixed banners have gotten a lot more common.

I'm surprised I couldn't find this bug already filed; it might be related to (but isn't the same as) bug 162369 and bug 414317.
Comment 1 Akkana Peck 2012-08-03 20:22:09 PDT
Sorry, make that second bug 354066 -- I don't think 414317 is related.
Comment 2 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2012-08-03 21:20:55 PDT
I don't think it's a regression. I think it's just that these sorts of pages have become more common.
Comment 3 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2012-08-03 21:23:18 PDT
We'll need some heuristics here. There can be fixed-pos header or footer elements that don't actually obscure page content and therefore ideally wouldn't affect scroll distance, but there's probably no foolproof way to distinguish those from the elements that should affect scroll distance.

When in doubt, I suppose we should err on the side of scrolling a bit less, although we can't allow the scroll distance to decrease too much.
Comment 4 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2012-08-05 19:47:55 PDT
(In reply to Akkana Peck from comment #0)
> I checked chromium and it does the right thing (only scrolls the visible
> part of the page) so I don't think it's a bug in the page (and I'm seeing
> this on lots of different sites).

FWIW I don't see Chrome 22 dev doing anything special. If I make the window small then I can definitely skip lines as I scroll down. Can you come up with a simple testcase that shows Chrome scrolling differently based on whether a fixed-pos element is present or absent?
Comment 5 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2012-08-05 21:37:14 PDT
Created attachment 649178 [details] [diff] [review]
fix
Comment 6 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2012-08-05 21:40:17 PDT
+/**
+ * Compute the scrollport size excluding any fixed-pos headers and
+ * footers. A header or footer is an box that spans that entire width
+ * of the viewport and touches the top (or bottom, respectively) of the
+ * viewport. Headers and footers that cover more than a quarter of the
+ * the viewport are ignored since they probably aren't true headers and
+ * footers and we don't want to restrict scrolling too much in such cases.
+ * This is a bit conservative --- some pages use elements as headers or
+ * footers that don't span the entire width of the viewport --- but it
+ * should be a good start.
+ */

It works well on many pages. No doubt there are some pages it doesn't work on. It seems like a good idea to start conservatively here.

BTW Akkana, thanks for the idea. This had been bothering me subtly for a long time but I never got around to thinking about the problem :-). More ideas for easy-to-implement wins welcome :-).
Comment 7 Timothy Nikkel (:tnikkel) 2012-08-08 11:26:44 PDT
Comment on attachment 649178 [details] [diff] [review]
fix

Nice. Sorry for the delay.
Comment 8 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2012-08-09 04:18:57 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/f67014b40e1e
Comment 9 Ed Morley [:emorley] 2012-08-09 05:20:20 PDT
Backed out for failures in test_page_scroll_with_fixed_pos.html:
https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=f67014b40e1e

https://hg.mozilla.org/integration/mozilla-inbound/rev/1f9d563e8542
Comment 10 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2012-08-12 22:22:08 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/94e4dbce3b94
Comment 11 Ed Morley [:emorley] 2012-08-13 11:11:02 PDT
https://hg.mozilla.org/mozilla-central/rev/94e4dbce3b94
Comment 13 Nicolas Barbulesco 2013-01-05 19:10:30 PST
(In reply to Akkana Peck from comment #0)

> I checked chromium and it does the right thing (only scrolls the visible
> part of the page) so I don't think it's a bug in the page (and I'm seeing
> this on lots of different sites). But of course I don't want to use
> chromium, I want to use firefox. :) It might be a regression -- I never used
> to see this, but maybe it's just that these fixed banners have gotten a lot
> more common.

The real right thing to do, by the page author, is either to let the banner be scrolled or to put it outside the scrollable area.

> so I don't think it's a bug in the page (and I'm seeing
> this on lots of different sites).

In my not-so-humble opinion, *it is a bug in the page*. The word "bug" can be discussed. But it is *a bad thing* in the page. An irritating trend.

Anyway, this kind of adjustment in the browser is a good idea.
Comment 14 Akkana Peck 2013-01-05 19:44:53 PST
Oh, I agree -- it's really annoying that site designers do that and I wish they wouldn't. But since they do, this fix is wonderful and has made it much easier to follow threads on sites like LinkedIn. THANK YOU!
Comment 15 Martin Ueding 2014-11-24 02:00:13 PST
It's been over 1.5 years now, and I do not notice that Firefox 33 would save me from those websites. What happened to the bug?
Comment 16 Daniel Holbert [:dholbert] 2014-11-25 11:07:21 PST
(In reply to Martin Ueding from comment #15)
> It's been over 1.5 years now, and I do not notice that Firefox 33 would save
> me from those websites. What happened to the bug?

It's unclear what you're asking about. This bug is marked as FIXED; patches landed to fix it, in Firefox 17, over 2 years ago. Are you talking about a something that was broken by the changes here?

If there's a bug filed on the issue you're describing, you probably want to comment on that bug. (or if there isn't, you should probably file a new bug with more details.)
Comment 17 Martin Ueding 2014-12-02 12:19:37 PST
(In reply to Daniel Holbert [:dholbert] from comment #16)
> It's unclear what you're asking about. This bug is marked as FIXED; patches
> landed to fix it, in Firefox 17, over 2 years ago. Are you talking about a
> something that was broken by the changes here?

When I use the space bar to scroll down on a website which has some fixed elements, it scroll too much, at least on the websites that I used. Then I searched the web for a solution to this and found this bug. Since I use the latest Firefox, but still have this issue on some websites, I thought that this bug might not be fixed fully yet.
Comment 18 Manu Sridharan 2015-11-12 09:40:32 PST
Not Firefox-specific, but I still run into this problem frequently, e.g., on this page:

http://www.nytimes.com/2015/11/15/travel/denver-airport-kim-day.html?_r=1

Scrolling with space bar is broken on that page in the latest Firefox, Chrome, and Safari on Mac (i.e., it scrolls a bit too far, skipping a couple of lines).  FF could differentiate itself by doing "the right thing" here.

Let me know if I should open a new bug for this issue.
Comment 19 Ryan VanderMeulen [:RyanVM] 2015-11-12 09:44:00 PST
(In reply to Manu Sridharan from comment #18)
> Let me know if I should open a new bug for this issue.

Please do. Definitely better than adding comments to a bug that was closed over 3 years ago.
Comment 20 Manu Sridharan 2015-11-12 10:28:48 PST
I added a comment on Bug 1081272, which might capture the new issue.
Comment 21 Daniel Holbert [:dholbert] 2015-11-12 10:31:35 PST
(Thanks! That bug is likely what comment 15 / comment 17 here were really about, too.)

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