-
Notifications
You must be signed in to change notification settings - Fork 219
Interactivity API: Disable scroll for Pagination block links inside Product Query #10522
Interactivity API: Disable scroll for Pagination block links inside Product Query #10522
Conversation
The release ZIP for this PR is accessible via:
TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. Script Dependencies ReportThe
This comment was automatically generated by the |
Size Change: 0 B Total Size: 1.34 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @DAreRodz, thank you for addressing this. I have a small suggestion that isn't a blocker. Considering its minor nature, I'm pre-approving the PR 🚀
@@ -138,7 +138,7 @@ public function add_navigation_link_directives( $block_content, $block, $instanc | |||
|
|||
$navigation_link_payload = array( | |||
'prefetch' => $is_previous_or_next, | |||
'scroll' => true, | |||
'scroll' => false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: I believe it would enhance the code if we could eliminate the need to explicitly pass false
when we don't intend to enable the scroll functionality. Perhaps we can modify the condition here to achieve this. What are your thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would have to decide what behavior we want to have by default. 🤔 Depending on the API we'd take as an inspiration, the scroll
value would be:
- true
location.assign()
location.replace()
navigation.navigate()
(experimental 🧪)
- false
I prefer to follow what the future navigation.navigate()
API is doing, i.e., to let the browser decide (most of the time, it would be scrolling by default). In any case, I think it would be a good idea to set the scroll behavior explicitly, at least for now.
Pinging @luisherranz in case he wants to add anything else. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For full-page client-side navigation, there's no doubt that the default should be scroll to the top.
For inner-content client-side navigation (what we are doing here), I'm not so sure. Maybe defaulting to not scrolling makes more sense.
So good points 🙂
Let's leave the default as true
for now, but keep an eye on it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as well!
Follow-up of #10200
Make links inside a Pagination block not to scroll to the top of the page, as requested in #10200 (comment).
Testing
User Facing Testing