Commit b5e64c1c authored by Maxym Borodenko's avatar Maxym Borodenko
Browse files

Scroll up page after apply or reset filters.

parent 505a5997
Pipeline #5394 passed with stages
in 3 minutes and 40 seconds
......@@ -16,10 +16,17 @@ const styles = (theme) => ({
//
// Renders a standard filters block
const FiltersBlock = ({ title, children, handleSubmit, onSubmit, initialize, classes }) => {
const scrollToTop = () => {
if (window) {
window.scrollTo(0, 0);
}
};
const onReset = (e) => {
log('Clearing form');
initialize({});
setTimeout(handleSubmit, 100);
scrollToTop();
};
// Remove empty arrays and null filters
......@@ -46,6 +53,7 @@ const FiltersBlock = ({ title, children, handleSubmit, onSubmit, initialize, cla
const processSubmit = handleSubmit((data) => {
console.log('Submitting', data);
scrollToTop();
return onSubmit(cleanFilters(data));
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment