iAPI Docs: Add client-side navigation guide under "Core Concepts"#75263
iAPI Docs: Add client-side navigation guide under "Core Concepts"#75263luisherranz merged 53 commits intotrunkfrom
Conversation
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
luisherranz
left a comment
There was a problem hiding this comment.
Amazing work so far, David! The guide is very well understood and covers a lot of topics.
For now, I've reviewed everything in depth up to the "Interactivity Router in depth" part, which I'll do on Monday, but that part looks very good too.
I'm adding a few comments here, and besides that, two other suggestions:
- Adding a link to this guide in the
interactivity-routerREADME, prominently at the top, since there may be users who end up there and, in reality, should always read this guide. - Adding a section explaining that neither the scroll nor the focus are handled by the router, and that they are the responsibility of the action calling
actions.navigate.
| ```bash | ||
| npx @wordpress/create-block@latest my-interactive-block --template @wordpress/create-block-interactive-template | ||
| ``` |
There was a problem hiding this comment.
@juanmaguitar, weren't you working on a template for client-side navigation? Could it be?
There was a problem hiding this comment.
I think you may refer to the example I was working on for the block development examples:
https://github.com/WordPress/block-development-examples/tree/trunk/plugins/interactivity-router-2f43f8
But it would be great to have a template for client-side-navigation. In fact, we could expand the existing @wordpress/create-block-interactive-template with a new variant for clien-side navigation (now it's easier because each variant can have its own structure of files #67768)
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
| ### Disabling navigation feedback | ||
|
|
||
| The Interactivity API router includes built-in feedback during navigation: | ||
| - **Loading animation**: A progress bar that appears during navigation. |
There was a problem hiding this comment.
It would be good to specify here what color is used for this bar, which I think is a CSS variable, like --color-primary or something like that?
There was a problem hiding this comment.
Woops, it looks like the loading bar is not using any CSS variables... 👀
There was a problem hiding this comment.
That's interesting. Maybe we had it in the first versions and we forgot to copy it during some migration? I'll put it on the roadmap.
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
|
@luisherranz, I think I've addressed all your feedback, including your suggestions: |
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
luisherranz
left a comment
There was a problem hiding this comment.
I've made some small changes in cc519b1, and here are some other suggestions for the in-depth part, which I think is quite good.
Apart from that, we should remove the section about block compatibility to do it separately and more carefully, and I wonder if we should also create a separate section for full-page client-side navigation.
Finally, I also wonder if we should remove most references to "interactive blocks" and blocks in general, since this also works with classic PHP themes.
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Show resolved
Hide resolved
docs/reference-guides/interactivity-api/core-concepts/client-side-navigation.md
Outdated
Show resolved
Hide resolved
|
Flaky tests detected in 6f8f7d1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/22636058579
|
|
@luisherranz, addressed your feedback. I'm doing an extra review of the whole document to make sure everything is fine.
I removed the block compatibility section. Do you think we should start working on another document to explain block compatibility now? Regarding full-page client-side navigation, do you mean a new document or a section in the same document? Asking because there's already a section at the end of the document.
Yup, we could emphasize somewhere in the document that client-side navigation works with classic themes as well. |
Yes.
I don't know, maybe it's fine as it is and we can move it in the future if it really deserves its own section.
Good idea. We could add a section at the beginning stating that it works with both blocks and classic themes. In fact, I'd like to make that much clearer throughout the documentation, as it currently seems like the Interactivity API only works with blocks. In principle, here I think we should just delete all the sentences that talk about interactive blocks, which in a way assume that this only works in interactive blocks, and only leave the mentions of interactive blocks for things specific to them ( |
What do you think about creating a new "Client Side Navigation" page under the iAPI docs root and inside of it another doc called "Block Compatibility Guide" The new structure would like this: Interactivity API Reference
Maybe this new "Client Side Navigation" page could also tackle #56638 |
|
I love the idea. Maybe we could also include one about Full-page client-side navigation in the future. |
|
I also like the idea. 😄 I think It would be a good opportunity to divide the guide (~1000 lines) in multiple documents. @juanmaguitar, how would the structure be exactly? A folder named |
luisherranz
left a comment
There was a problem hiding this comment.
I just pushed some minor changes. It would be great if you could review it.
Apart from that:
- We should include information about
data-wp-keyand how to use that directive so that lists work correctly when navigating. - We should also add information about how to inject
data-wp-router-options='{"loadOnClientNavigation": true}'attribute using the PHP APIs (wp_interactivity()->add_client_navigation_support_to_script_module), and when it's automatically added (blocks withsupports.interactivity).
469b49d to
6f8f7d1
Compare
luisherranz
left a comment
There was a problem hiding this comment.
LGTM! ❤️
Awesome work, David. This is a really, really good guide.
What?
Adds a "Core Concepts" guide for the Interactivity Router.
Why?
The Interactivity Router, while being documented in the README, lacked an in-depth explanation about how it works.
How?
The document follows this structure:
supports.interactivityfield