Make it possible to focus/reveal specific elements via action. Here are three scenarios in which this would be very helpful:
Scroll to element after form submit success: A form adds elements to a list, on successful submit the new element should be revealed (even if it requires scrolling the page). This is necessary in case the form input field is on a different position on the page than the results.
Show last element in a sub view: amp-bind makes it possible to implement master/detail views. This would work even better if once could reveal specific elements on the detail view:
Focus form input fields in lightbox: lightboxes are great for form inputs, make it possible to set focus to a specific form input field once the lightbox opens:
//cc @ericlindley-g
@ericlindley-g this aligns nicely with some of the FR @alanorozco is doing this sprint (#7027, #649) so I suggest Prioritized FR milestone.
+1 This would be great — particularly if we could smoothly animate the scrolling into view (as opposed to a "jump cut")
This is a great idea and it seems like it's almost a requisite to make the amp-bind story really useful.
One small caveat re: our current implementation of actions. Since originally only one action per event was supported, chaining actions wouldn't be a problem. Currently, action results can potentially be asynchronous so certain user expectations would not be matched since the action sequence is executed synchronously.
This needs more thought to answer whether we're ok with this. If we're not, then a more robust promise-chaining mechanism is needed.
This is more relevant for #649, but the case presented here made me think of this.
Relevant: https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/zz7AqKAfVTY/N9YQ9BSiDQAJ
@spacedino UX might be needed for the animation curve of the smooth scrolling. Chrome is also adding this feature, We might be able to just borrow the curve from their implementation.
@sebastianbenz @ericlindley-g FYI, feature merged today, will be in Canary this week.
Most helpful comment
@sebastianbenz @ericlindley-g FYI, feature merged today, will be in Canary this week.