Keep the reader's place when a filter narrows the product list - #217
Open
boo-code wants to merge 1 commit into
Open
Keep the reader's place when a filter narrows the product list#217boo-code wants to merge 1 commit into
boo-code wants to merge 1 commit into
Conversation
|
Hello @boo-code! This is your first pull request on classic-theme repository of the PrestaShop project. Thank you, and welcome to this Open Source community! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
window.scrollTo(0, 0), which runs for every product list refresh - narrowing a filter as much as turning a page. Paging is the one case where the jump makes sense, because the products the shopper was looking at are gone; a filter keeps most of them. The scroll now happens only for pagination, and it targets the list header rather than the very top of the document.Where it comes from
_dev/js/listing.js:Every route into the listing ends here - the filter checkboxes, the sort select, "clear all", the facet links and the pagination links, since in this theme pagination links also carry
js-search-link. So the same jump is applied to all of them.The behaviour this aligns with
The Hummingbird theme already separates the two. It scrolls in the pagination branch only, and to the list header:
This change gives the classic theme the same rule. Pagination is told apart by the link sitting inside
nav.pagination, which is whattemplates/_partials/pagination.tplrenders, rather than by a new selector.Scope
Read from the sources;
assets/is not tracked here, so this is a_devonly change. The report is filed against 8.2, and the handler is unchanged ondevelop, which is why it is still worth fixing rather than closing as outdated. I have not run the classic theme on a live shop for this - the mechanism is a single unconditional call in the handler, and the contrast with Hummingbird is in the code above.