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

[AMP Stories] Fix default Inserter in the Toolbar #1966

Closed
miina opened this issue Mar 14, 2019 · 9 comments
Closed

[AMP Stories] Fix default Inserter in the Toolbar #1966

miina opened this issue Mar 14, 2019 · 9 comments
Labels
Bug Something isn't working
Milestone

Comments

@miina
Copy link
Contributor

miina commented Mar 14, 2019

Currently, the Inserter in the upper Toolbar doesn't seem to work as expected. It seems to allow adding a Page within a Page and not allow the allowed child blocks.
Steps to reproduce:

  • Add a Page and a block (or some blocks);
  • Select a block within the Page;
  • Click on the default Inserter in the toolbar.
@miina miina added Bug Something isn't working AMP-Stories labels Mar 14, 2019
@swissspidy
Copy link
Collaborator

There was a recent bug fix in Gutenberg for the global inserter in the toolbar: WordPress/gutenberg#14020. It will be included in 5.3.

Let's test this with the current development version to see if anything changed for us. After all we do some on-the-fly filtering there.

@swissspidy
Copy link
Collaborator

I just installed 5.3 RC 1 and it seems to work fine now!

  1. Add page
  2. Select block within page
  3. Click on global inserter in the toolbar
  4. See the full list of allowed child blocks (no pages or anything.

When a page or no block at all is selected, then the global inserter only allows you to insert pages.

@swissspidy swissspidy reopened this Apr 2, 2019
@amedina
Copy link
Member

amedina commented Apr 2, 2019

The flow when editing a page and I want to insert components to it does not work as expected.

For example: I am on a blank page, click on the inserter on the top left corner, and only the page block is available. The expected scenario is for the user to see all the blocks that can be inserted, and also the possibility of adding a new page.

@miina
Copy link
Contributor Author

miina commented Apr 2, 2019

@amedina That's the default behavior of the Inserter of Gutenberg -- it always shows what you can insert after the currently selected block. For example, if a Page is selected then you can insert only another Page after it and that's why only a Page shows, since the other blocks can't be inserter after the Page, they could only be inserter inside the Page.

On a blank page by default no block is selected, that's why the inserter shows only the Page -- this would insert a new Page. If it would show other blocks there, too, then it wouldn't be clear where they could be inserter. By default to the root element, but these are not allowed there.

Perhaps ideally if a Page is selected then other blocks would also be displayed and if a non-Page block would be inserted, it would be inserted as the last block of the selected Page.
However, not sure how easy it would be to change the default behavior. Thoughts, @swissspidy?

@swissspidy
Copy link
Collaborator

Perhaps ideally if a Page is selected then other blocks would also be displayed and if a non-Page block would be inserted, it would be inserted as the last block of the selected Page.

Agreed. We turn Gutenberg a bit on its head with the way stories are edited, so changing the behavior here makes sense.

However, not sure how easy it would be to change the default behavior.

Neither am I. There are some issues surrounding the inserter, e.g. WordPress/gutenberg#14515, so we'd have to take a deeper look.

@amedina
Copy link
Member

amedina commented Apr 2, 2019

We need to devise a solution because the flow is broken. One approach would be to have always a page selected, either explicitly by the user or by default following some heuristic (e.g. the leftmost page, the most recent, etc).

@swissspidy
Copy link
Collaborator

For clarification, we already have a page that is always the "current" page. It's the one in the center of the screen. Having this block always selected (i.e. block toolbar and drag handles are always shown) sounds a bit odd, and as Miina said, wouldn't solve the issue anyway:

If a Page is selected then you can insert only another Page after it and that's why only a Page shows

@swissspidy
Copy link
Collaborator

QA: Access the inserter via the top left "+" (plus) icon button:

Screenshot 2019-04-11 at 14 22 21

Verify that, no matter what block is currently selected in the editor, you are able to insert all blocks using that inserter. Call-to-Action blocks should not be shown when editing the first page.

@csossi
Copy link

csossi commented Apr 11, 2019

Verified in QA

@westonruter westonruter added this to the v1.2 milestone May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants