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

Add filter to opt out of automattic Nav fallback behaviour #50351

Open
getdave opened this issue May 4, 2023 · 5 comments
Open

Add filter to opt out of automattic Nav fallback behaviour #50351

getdave opened this issue May 4, 2023 · 5 comments
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Type] Enhancement A suggestion for improvement.

Comments

@getdave
Copy link
Contributor

getdave commented May 4, 2023

With the merge of #48698 a fallback Navigation Menu will now automatically be created when an empty (i.e. no ref attribute) Navigation block is present

  • in the Editor
  • on the front of the site

Given this, should the feature be "opt in"? To do this we would need to:

  • add a Boolean filter defaulting to true.
  • conditionalise the fallback routine to return empty blocks if the filter is falsey.

I think it would be ok to allow the editor REST call to occur, but if it returns empty then the ref would not be set to the fallback ID so no fallback would be set resulting in an empty menu.

Curious to hear thoughts before we proceed - @scruffian and @draganescu.

@getdave getdave added the [Block] Navigation Affects the Navigation Block label May 4, 2023
@getdave getdave self-assigned this May 4, 2023
@scruffian
Copy link
Contributor

Has this come from a user request? Maybe it's worth seeing if there's a need before we add another filter to core?

@getdave
Copy link
Contributor Author

getdave commented May 5, 2023

I was basing this on @hellofromtonya's previous advice/mantra that if functionality is automatic or new, it should be possible to opt out of it. We don't currently have any specific user request.

@draganescu
Copy link
Contributor

I think the only thing the opt out would do is avoid one single post being created. Doesn't look like it's worth another filter. I do think it's good practice to enable opting out of things, and it is in accordance with the WordPress way but sometimes it just feels like it's not worth the hassle. There are the important filters in place - those to modify what the fallback does - so the one that just disables the saving seems a bit pointless?

@getdave
Copy link
Contributor Author

getdave commented May 5, 2023

My view on this is that we're auto-creating a Post in the users' database so we should allow them to opt out of that if they'd like. I don't have a super strong feeling about it but I thought it was worth a discussion.

@scruffian
Copy link
Contributor

We only create the post if they use the block though, so it doesn't feel super intrusive to me.

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Jul 20, 2023
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 [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants