forked from CGM_Public/pretix_original
Add autoscroll to widget after changing pages (Z#23135651) (#3698)
* Add autoscroll to widget after changing pages * revert add autoscroll to widget * add watcher on root.view * check if scrollIntoView is necessary --------- Co-authored-by: Richard Schreiber <schreiber@rami.io>
This commit is contained in:
@@ -2005,7 +2005,19 @@ var create_widget = function (element) {
|
||||
observer.observe(this.$el, observerOptions);
|
||||
},
|
||||
computed: shared_root_computed,
|
||||
methods: shared_root_methods
|
||||
methods: shared_root_methods,
|
||||
watch: {
|
||||
'view': function (newValue, oldValue) {
|
||||
if (oldValue) {
|
||||
// always make sure the widget is scrolled to the top
|
||||
// as we only check top, we do not need to wait for a redraw
|
||||
var rect = this.$el.getBoundingClientRect();
|
||||
if (rect.top < 0) {
|
||||
this.$el.scrollIntoView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
create_overlay(app);
|
||||
return app;
|
||||
|
||||
Reference in New Issue
Block a user