diff --git a/Resources/public/js/apps/ez-platformuiapp.js b/Resources/public/js/apps/ez-platformuiapp.js index e7978ea46..fcaa8b9b9 100644 --- a/Resources/public/js/apps/ez-platformuiapp.js +++ b/Resources/public/js/apps/ez-platformuiapp.js @@ -1228,6 +1228,19 @@ YUI.add('ez-platformuiapp', function (Y) { routingEnabled: { value: true, }, + + /** + * Boolean that determine if by default document should be scrolled to top on navigation + * + * @attribute scrollToTopDefault + * @default true + * @readOnly + * @type {Boolean} + */ + scrollToTopDefault: { + readOnly: true, + value: true, + }, } }); }); diff --git a/Resources/public/js/views/services/ez-searchviewservice.js b/Resources/public/js/views/services/ez-searchviewservice.js index f4a01161d..df94d2b52 100644 --- a/Resources/public/js/views/services/ez-searchviewservice.js +++ b/Resources/public/js/views/services/ez-searchviewservice.js @@ -22,9 +22,18 @@ YUI.add('ez-searchviewservice', function (Y) { Y.eZ.SearchViewService = Y.Base.create('searchViewService', Y.eZ.ViewService, [], { initializer: function () { + var app = this.get('app'); + this.on('*:searchRequest', function(e) { + // Setting scrollToTop to false, so requesting more results won't scroll back to top of the page. + app.set('scrollToTop', false); this._navigateToDoSearch(e); }); + + this.on('*:destroy', function() { + // Returning scrollToTop to previous value. + app.set('scrollToTop', app.get('scrollToTopDefault')); + }); }, /**