Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing filters shouldn't force the user to the top #10993

Closed
dennispw opened this issue Oct 12, 2018 · 15 comments
Closed

Changing filters shouldn't force the user to the top #10993

dennispw opened this issue Oct 12, 2018 · 15 comments
Labels
FO Category: Front Office Improvement Type: Improvement No change required Resolution: issue closed because expected as is

Comments

@dennispw
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When using the pagination or changing filters (using the ps_facetedsearch module as an example), the user is scrolled to the top of the document. This is considered bad practice since you are taking the control out of the users hands. It could be useful when using the pagination as long as the pagination is located at the bottom of the page but other than that I would really reconsider this functionality.

As an example, you often have to scroll down a bit to see the products and any sorting options or filters. Let's say you wanted to selec the "Size: XL" filter. You scroll down, find it and unfortunately you hit the "Size: L" by mistake. Now you're back at the top of the page and have to scroll down yet again.

Another example, let's say you want to filter on "Color: Blue" and "Color: Red". You have to scrolldown twice for each selection.

It get's even worse if you're on a mobile device where the total length of the content is usually longer.

Every single input made by the user will most likely result in having to scroll down - don't take the control out of the users hands unless absolutely necessary. This is something each individual shop owner and/or theme should be in control of and not the core platform.

Describe the solution you'd like
Simply don't force a scroll to the top.

Additional context
I initially reported this in the forge but nothing happened: BOOM-4608

@khouloudbelguith
Copy link
Contributor

Hi @dennispw,

Thanks for your report.
This feature it is added in the PS 1.7.2.2.
Here's the PR: #8082
Thanks to check & feedback.

@khouloudbelguith khouloudbelguith added Improvement Type: Improvement FO Category: Front Office NMI Status: issue needs more information labels Oct 12, 2018
@dennispw
Copy link
Contributor Author

Yes I know that it's added but it's not good practice. The only time it would actually be useful is if the user is at the bottom of the page. It shouldn't force a scroll to the top when changing sort orter, changing filters and more. It's a very disruptive pattern. Every time the user makes a choise he/she is forced to scroll no matter what.

At the very least we as theme makers (and possible even shop owners) should have the possibility to change that behaviour. But since it's inbedded in the core we can't do anything except trying to hinder it with even more scripts which obviously isn't ideal at all.

@khouloudbelguith
Copy link
Contributor

@marionf what do you think about this issue?
After clicking the next page with few / more products in the FO, will be scrolled top to the list, this issue exists from 1.7.2.2.
Thanks!

@marionf marionf added Needs Specs Status: issue needs to be specified and removed NMI Status: issue needs more information labels Oct 15, 2018
@dennispw
Copy link
Contributor Author

@khouloudbelguith @marionf Any update on this? I would like to know what you are planning to do here because if this behaviour is here to stay I will have to make some sort of override for future builds since it's not optimal at all in it's current state.

@khouloudbelguith
Copy link
Contributor

Hi @dennispw,

Sorry not yet.
It should be specified by our developers.
Thanks!

@karopka
Copy link

karopka commented Nov 27, 2018

@khouloudbelguith @marionf Any update on this? I would like to know what you are planning to do here because if this behaviour is here to stay I will have to make some sort of override for future builds since it's not optimal at all in it's current state.

Do you have any workaround for this to use while prestashop team have other priorities?

@karopka
Copy link

karopka commented Nov 27, 2018

I found a temporary solution. It is necessary to comment out this line in themes/core.js:
window.scrollTo(0, 0);
But you need to remember about it and check after each update of the core.

@khouloudbelguith
Copy link
Contributor

Hi @karopka,

Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/PrestaShop/tree/develop
Thank you!

@dennispw
Copy link
Contributor Author

@karopka That's basically it. Not optimal by a long shot but it's basically it unfortunately.

Looking at the code it seems to be specifically added when using the pagination and since it's added to the core I have a hard time seeing it will be changed any time soon, even if a pull request is made.

Git blame: 9245f05

As I've said prior to this, if this is indeed the intended behaviour there should at the very least be some sort of check if the user has used the paginaton and only then scroll the user to the top. Or better, scroll them to the top of the products. Of course even better than that, don't do anything at all and leave that decision up to the owners of each shop and/or theme developers.

@marionf marionf added the Waiting for PM Status: action required, waiting for product feedback label Nov 27, 2018
@dennispw
Copy link
Contributor Author

dennispw commented Nov 28, 2018

@khouloudbelguith I've attached a video to better explain the issue. Every single click tied to the filter, pagination and/or sort order causes a jump to the top.

Demo: Screen record (.zip)

It's an extremely disruptive pattern. As of right now, there is no proper way to disable this behaviour. The only two options we really have are:

  • Modifying the core.js file and keep doing so with each update
  • Using JS hacks - more or less - such as setting an arbitrary setTimout that is long enough to be run after the core.js scroll function.

@khouloudbelguith
Copy link
Contributor

khouloudbelguith commented Nov 28, 2018

@dennispw, Thank you for reporting this issue and how you want to fix it.
Our dev will take into account your suggestions.
Also, If you know how to fix it, you can make a pull request on GitHub with your code suggestion?

@karopka
Copy link

karopka commented Nov 28, 2018

Yesterday I tried to do it but the file core.js in the dev branch is compressed. It's ok to create pull request with uncompressed file?

@khouloudbelguith
Copy link
Contributor

@karopka, you can create a PR & our Dev will help you getting it right.
Thanks!

@dennispw
Copy link
Contributor Author

@khouloudbelguith I've added a PR.

@marionf marionf removed the Waiting for PM Status: action required, waiting for product feedback label Nov 28, 2018
@marionf marionf added this to To do in PrestaShop 1.7.6 via automation Nov 28, 2018
@marionf marionf moved this from To do to To be tested in PrestaShop 1.7.6 Nov 28, 2018
@marionf marionf added No change required Resolution: issue closed because expected as is and removed Needs Specs Status: issue needs to be specified labels Nov 29, 2018
@marionf marionf closed this as completed Nov 29, 2018
PrestaShop 1.7.6 automation moved this from To be tested to Done Nov 29, 2018
@marionf marionf removed this from Done in PrestaShop 1.7.6 Nov 29, 2018
@marionf
Copy link
Contributor

marionf commented Nov 29, 2018

Hello @dennispw

There will always be cases where it will be necessary to scroll up or down according to the number of products displayed on the page, the number of filters configured in faceted search, the device used ...

So, we talked about this with @TristanLDD & @colinegin and we don't want to change the current behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FO Category: Front Office Improvement Type: Improvement No change required Resolution: issue closed because expected as is
Projects
None yet
Development

No branches or pull requests

4 participants