Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions app/code/Magento/Ui/view/base/web/js/grid/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ define([
'uiLayout',
'mage/translate',
'mageUtils',
'uiElement'
], function (_, layout, $t, utils, Element) {
'uiElement',
'jquery'
], function (_, layout, $t, utils, Element, $) {
'use strict';

return Element.extend({
Expand All @@ -29,11 +30,13 @@ define([
tracks: {
value: true,
previews: true,
inputValue: true
inputValue: true,
focused: true
},
imports: {
inputValue: 'value',
updatePreview: 'value'
updatePreview: 'value',
focused: false
},
exports: {
value: '${ $.provider }:params.search'
Expand Down Expand Up @@ -88,6 +91,18 @@ define([
return this;
},

/**
* Click To ScrollTop.
*/
scrollTo: function ($data) {
$('html, body').animate({
scrollTop: 0
}, 'slow', function () {
$data.focused = false;
$data.focused = true;
});
},

/**
* Resets input value to the last applied state.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
-->
<div class="data-grid-search-control-wrap">
<label class="data-grid-search-label" attr="title: $t('Search'), for: index">
<label class="data-grid-search-label" attr="title: $t('Search'), for: index" data-bind="click: scrollTo">
<span translate="'Search'"/>
</label>
<input class="admin__control-text data-grid-search-control" type="text"
Expand All @@ -16,6 +16,7 @@
placeholder: $t(placeholder)
},
textInput: inputValue,
hasFocus: focused,
keyboard: {
13: apply.bind($data, false),
27: cancel
Expand Down