amp-live-list - scrolling on new items why?
Hi,
Although I can see a reason why amp-live-list scrolls I (and my team) also wonder if it would be possible to configure it not to scroll, or to scroll to a point other than the top of the window.
I'm using it to update a live blog and want to new items on the live-list to appear below a fixed set of data which I'm using the data-update-time= to update in-place.
I currently am using a CSS workaround but when I demo it to my team they all ask why does it scroll the way it does, more flexibility on if / when / where it scrolls would be a useful addition.
Alan
/to @ericlindley-g @erwinmombay
Interesting — @QES, is it the case that it's scrolling to the very top of amp-live-list, beyond where the actual update is happening?
Adding an option to amp-live-list (maybe an attribute like disable-auto-scroll) to disable auto-scroll seems reasonable. And then when the .focus() method is available, it would be possible to smoothly scroll wherever you'd like.
WDYT, @erwinmombay ?
BTW: @aghassemi — maybe it makes sense to re-use the logic/code from amp-live-list's scrolling behavior to implement the .focus() method?
To follow up your question @ericlindley-g "is it the case that it's scrolling to the very top of amp-live-list, beyond where the actual update is happening?"
The problem is for me it scrolls to the very top of the window, ie the updated comment is now at the very top of the iPhone screen.
We have something where we want to maintain some overview info about the event which it shouldn't push up the screen.
The ideal would be to be able to select either a
Thanks — that's what I thought, so some things we're working on should help you out.
I'm not sure exactly what the .focus() method will look like, but I believe the plan is for it to be able to designate a particular element id to scroll the top of the viewport to.
Until that is available, I wonder if it would work to have a separate amp-live-list for each container of content. For instance, you could put the fixed set of data in amp-live-list[id="fixed-data"], and the list of updates in a separate amp-live-list[id="list-of-updates"], and then set the update button for amp-live-list[id="fixed-data"] to visibility:hidden. One thing I'm not sure of is if both lists would be updated by just clicking on one of the update buttons.
@erwinmombay: do you know if that's the case? Is this a realistic way to solve this issue for now, or are there other, better ways?
Currently that is what I am doing (not knowing exactly how this was supposed to work) the page now consists of - I didn't realise that within a live-list you could mix changing updates to some text and new updates to the same list. So I have four separate elements on the page that are there own live-list elements for the fixed elements on the page that change as the score changes and one that contains the updates themselves.
What I have seen is that elements that ONLY have elements of the live-list that have both a sort-time and an update-time never seem to trigger the button that goes with them but just updates the message, while the ones that only have an update-time and which contain new messages update only when you click on the update button.
Because of the way things are on the page I'm not 100% of the behaviour but am doing some tests to check that in the next day or two to better understand the behaviour of the amp-live-list elements.
I may of course be implementing this not in the way anticipated and may be breaking something down the road but it actually makes it easier to manage some of the elements I have as the rest of the page can be outside of the amp-live-list element, trying to explain is quite hard as the amp-live-list elements are only inserted when an event is live for example http://amp.sportsmole.co.uk/football/man-utd/fa-cup/live-commentary/live-commentary-chelsea-vs-man-utd_293717.html (is live for the next 3 hours).
Thanks for your thoughts and insights.
should we prioritize this for next sprint? does that sound good @ericlindley-g ?
@erwinmombay — do you have any thoughts about some of the questions above? Would it be possible to use two amp-live-list elements on the same page to support the need here?
I"ve been living with this and various workarounds.
When looking at another area of the site I discovered a sugestion for when you click on an internal link and using the CSS ::before to insert space into an element.
It struck me that an alternative to giving amp-live-list a new function would be to ensure that the "tap" functionaility behaves in a way that one of the pseudo classes (for example :target ) is used for #anchor elements and this function does that but uses something very similar but not the same.
This would also solve #6973 which sees this issue on Google's AMP Cache when it loads a new element it scrolls beyond the correct place when the on="tap:live-commentary.update" is clicked and using some css like:
amp-live-list#
Hope that makes sense and is a simple workaround to the issues.
Any update to this?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.