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
✨ amp-sidebar: support autoscroll #20524
Conversation
@CrystalOnScript merging to make the Canary cut, will implement any changes you like to see in the next PR. @honeybadgerdontcare I am gonna go with assumption this is very likely safe and merge to make the Canary cut, let me know if you find anything later and I'll deal with it. Thanks! |
@aghassemi okay, I'll skip testing it then |
This change breaks a small number of documents which have an I suggest we revert this change for now, and then reconsider how to move it forward again. |
@newmuis Jon, we are working on validation rules for this. Do you want to allow this (essentially the second gif in the description) in AMP Story or should we prevent it? |
It can be allowed, since (AFAICT) it does not have any effect on the document outside of the sidebar. /cc @bramanudom who owns the |
Closes #19570
amp-sidebar
can automatically scroll the overflowing container to first element that is decorated withautoscroll
an attribute in both sidebar and toolbar cases.This feature is useful when dealing with long navigation list and wanting the sidebar to scroll to the current navigation items when page loads.
When using
toolbar
feature,autoscroll
only works if the<nav toolbar>
element is set tooverflow: auto
oroverflow: scroll
.Demo
https://aghassemi-amphtml.firebaseapp.com/examples/amp-sidebar-autoscroll.amp.html
Snippet
Responsive (desktop and mobile)
Mobile only
Full Example:
https://github.com/ampproject/amphtml/blob/2ed7c73b405fff323400aee331c32602945bebb6/examples/amp-sidebar-autoscroll.amp.html
/To @alanorozco @CrystalFaith
/FYI @pbakaus @nainar