-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat(scroll): add top offset when automatically scrolling to main-scroll-item #1277
feat(scroll): add top offset when automatically scrolling to main-scroll-item #1277
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was curious about this and started testing it, but I can't do what I want, it might be some kind of uselessness on my end, but I would like to check it together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to test it on the archetype and it seems like the element to scroll is always at the bottom. Maybe we can check it together.
It works perfectly with the regular results ( |
@@ -99,7 +112,9 @@ | |||
oldObserver?.unobserve(this.$el); | |||
newObserver?.observe(this.$el); | |||
if (this.pendingScrollTo === this.item.id) { | |||
this.$el.scrollIntoView(); | |||
Vue.nextTick(() => { | |||
this.$el.scrollIntoView(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.$el.scrollIntoView(); | |
this.$el.scrollIntoView({block: 'center'}) |
After doing some testing, this seems a good option. This option centers always the item in the viewport, so we would have some part of the previous row visible, but the specified item will be always in the view port.
Downside: We would have to modify some test probably.
EMP-2021
Motivation and context
Depending on the setup's header it was possible that, when automatically scrolling to an element in the main scroll, the element was cut by the header. This feature adds a prop to the main-scroll-item to add an offset to the scrolling.
Type of change
What is the destination branch of this PR?
Main
How has this been tested?
Set the prop and reload a url that has
scroll
attribute.