This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22176 - Allow scrolls to elements to be positioned at an offset of the viewport
Summary: Allow scrolls to elements to be positioned at an offset of the viewport
Status: RESOLVED NEEDSINFO
Alias: None
Product: CSS
Classification: Unclassified
Component: CSSOM View (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-27 11:21 UTC by Simon Pieters
Modified: 2013-08-08 13:28 UTC (History)
0 users

See Also:


Attachments

Description Simon Pieters 2013-05-27 11:21:38 UTC
http://lists.w3.org/Archives/Public/www-style/2013May/0361.html

[[
> Similarly, I've seen a lot of the social sites that support j/k style
> navigation between posts do this: plus.google.com and the tumblr feed I'm
> pretty sure do it.

This doesn't update the URL bar or the history, and wants to scroll an  
element into view, so scrollIntoView() seems like the best fit here.

An issue though is that plus.google.com's j/k navigation wants to position  
the post under the header, so a normal link doesn't work, and the current  
scrollIntoView() doesn't work, either (the post would be positioned behind  
the header).

We could make scrollIntoView() take an argument that supports positioning,  
which has been proposed in  
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17152 but that proposal  
seems suboptimal here where we want "under the header" rather than "X%  
 from the top of the viewport".

For pages that have a fixed header, I think it would be nice to be able to  
offset navigations/scrolls to elements. For instance, we could introduce  
something like

@viewport { scroll-top-offset: 100px; scroll-left-offset: 50px; }

which would cause both <a href="#foo"> links and scrollIntoView() to  
scroll to that offset instead of the top of the viewport.

What do people think?
]]
Comment 1 Simon Pieters 2013-06-18 09:20:28 UTC
This should be aware of vertical writing modes.
Comment 2 Simon Pieters 2013-06-18 09:59:12 UTC
I'd like to see implementor interest before specifying this.