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

Navigation block: Immediately insert block when only one block type is allowed #16659

Closed
mtias opened this issue Jul 18, 2019 · 8 comments · Fixed by #16708
Closed

Navigation block: Immediately insert block when only one block type is allowed #16659

mtias opened this issue Jul 18, 2019 · 8 comments · Fixed by #16708
Assignees
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress

Comments

@mtias
Copy link
Member

mtias commented Jul 18, 2019

A nice quality of life change would be to tweak the inserter mechanisms for inner blocks areas so that if there is only one allowed block type, we insert it instead of opening the inserter.

This would allow creating blocks like "buttons row" where the inserter automatically adds a new child block of the specified type, simplifying insertion process.

@mtias mtias added Good First Issue An issue that's suitable for someone looking to contribute for the first time [Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P labels Jul 18, 2019
@marekhrabe
Copy link
Contributor

Looking more into this…

@marekhrabe marekhrabe self-assigned this Jul 22, 2019
@marekhrabe
Copy link
Contributor

marekhrabe commented Jul 22, 2019

I made a very terrible "button row" block to test with (will publish later) and I've noticed it would be really nice if the appender (plus button) inserted the only allowed block immediately on click instead of opening the full inserter with a single option. I'll also look into that.

Appender in my terrible button row block:

Screenshot 2019-07-22 at 16 45 47

It could say "Add BlockName" in the single-allowed-block-type mode.

This is the inserter with only one option available. Not very useful:

Screenshot 2019-07-22 at 16 48 06

@draganescu draganescu mentioned this issue Jul 22, 2019
5 tasks
@draganescu
Copy link
Contributor

@marekhrabe I added a PR, still work in progress I think that should implement this idea: #16708

@marekhrabe
Copy link
Contributor

@draganescu Thanks for the PR! I wish you said something sooner. I've assigned the issue to myself, wrote a comment that I'm working on it and even shared some of my progress and yet we ended up working on the same thing in parallel without my knowledge, wasting half of my day :(

Please say something next time, I'd be more than happy to pass the issue or collaborate on it.

@marekhrabe marekhrabe assigned draganescu and unassigned marekhrabe Jul 23, 2019
@mtias
Copy link
Member Author

mtias commented Jul 24, 2019

@marekhrabe perhaps you can continue with the "Button Row" (or updating core Button) to use this? I'd love to have this: #16480

@draganescu
Copy link
Contributor

@marekhrabe yes this happens sometimes on GH, I am sorry!

I started as an exploration (the branch name is try/*) and shared it as work in progress. I mentioned you exactly because I noticed your comment :) but alas after pushing my code, and figured we could collaborate. Please, feel free to review #16708 and/or propose a better way as I am not sure my take is the best

@noisysocks noisysocks added the [Block] Navigation Affects the Navigation Block label Aug 29, 2019
@noisysocks noisysocks removed the [Block] Navigation Affects the Navigation Block label Aug 29, 2019
@noisysocks noisysocks changed the title Directly Insert Block when allowedBlockTypes has only one block Navigation block: Immediately insert block when only one block type is allowed Sep 24, 2019
@noisysocks noisysocks added the [Status] In Progress Tracking issues with work in progress label Sep 24, 2019
@draganescu
Copy link
Contributor

@shaunandrews this would also be another great place to discuss the opportunity of implementing this option. As we discussed in this thread you made some very good points on why we shouldn't.

As @mtias is the author of this issue and I've also went ahead and implemented an overall update that allows for this feature to happen, independently of the Navigation block, we could arrive here at a conclusion on the steps for moving forward with this small feature.

@mtias
Copy link
Member Author

mtias commented Oct 24, 2019

Let's add this functionality please, it doesn't make sense to force people to choose a block when there is only one block in the inserter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P Good First Issue An issue that's suitable for someone looking to contribute for the first time [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants