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

Avoid automated behaviours in the Navigation block when in preview mode #45887

Open
scruffian opened this issue Nov 18, 2022 · 3 comments
Open
Labels
[Block] Navigation Affects the Navigation Block [Feature] Navigation Menus Any issue relating to Navigation Menus Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.

Comments

@scruffian
Copy link
Contributor

In #44173 we introduced a fallback to classic menus. This is also triggered when the block is previewed in a pattern browser. We should detect whether we are in a preview state, using an __unstableIsPreviewMode attribute ( introduced here), and if we are then we shouldn't import the classic menu.

@scruffian scruffian added the [Block] Navigation Affects the Navigation Block label Nov 18, 2022
@getdave getdave changed the title Navigation: Classic block fallbacks: Don't import classic menus when loading a preview Avoid automated behaviours in the Navigation block when in preview mode Mar 17, 2023
@jordesign jordesign added [Type] Enhancement A suggestion for improvement. [Feature] Navigation Menus Any issue relating to Navigation Menus labels Jul 28, 2023
@getdave
Copy link
Contributor

getdave commented Nov 8, 2024

This feels immediately actionable.

Next steps:

  • verify issue still occurs
  • implement conditionals to avoid running automated behaviours when in preview mode

cc'ing @ntsekouras who originally implemented __unstableIsPreviewMode and may have information on its stability and utility in this scenario.

@getdave getdave added the Needs Dev Ready for, and needs developer efforts label Nov 8, 2024
@ntsekouras
Copy link
Contributor

Yeah, the flag was actually stabilized recently here and the name is isPreviewMode now.

@getdave
Copy link
Contributor

getdave commented Nov 8, 2024

Having looking into this I'm not entirely clear on the bug we're solving here. We can now easily disable automated behaviours based on getSettings().isPreviewMode but doing this means that all the Nav blocks in the Patterns are empty.

If this is somehow specific to Classic Menus as @scruffian alluded to in the description then I think we need to be clearer. For now I'm removing this from the priority list on the Tracking Issue as there doesn't appear to be much movement on it or requests for resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Feature] Navigation Menus Any issue relating to Navigation Menus Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants