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 menu block: allow editing of new menu items from the block inspector UI #20748

Closed
enriquesanchez opened this issue Mar 9, 2020 · 15 comments · Fixed by #22210
Closed
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Feature] List View Menu item in the top toolbar to select blocks from a list of links. Needs Dev Ready for, and needs developer efforts

Comments

@enriquesanchez
Copy link
Contributor

A suggestion from #20742.

The block navigator in the navigation menu block has proven to be a familiar and easy way to navigate UI, particularly for users who are using only a keyboard.

76255145-4d5c0b80-6213-11ea-876a-7d02a83d8bbd

Currently you can add new links from it, but one missing piece that would make it much more useful is to also be able to edit new menu items (name, URL, etc) right from the block navigator.

@enriquesanchez enriquesanchez added the [Block] Navigation Affects the Navigation Block label Mar 9, 2020
@mtias mtias added [Feature] List View Menu item in the top toolbar to select blocks from a list of links. Needs Design Needs design efforts. labels Mar 9, 2020
@enriquesanchez
Copy link
Contributor Author

Split out from #20369

@mapk
Copy link
Contributor

mapk commented Apr 6, 2020

Not a bad idea. In conjunction with #11408, it could get overwhelming, so it needs some design work to figure out how that interaction might work.

@karmatosed karmatosed self-assigned this Apr 7, 2020
@karmatosed karmatosed added the [Priority] High Used to indicate top priority items that need quick attention label Apr 7, 2020
@mapk
Copy link
Contributor

mapk commented Apr 23, 2020

This prototype focuses on the subnav aspect. I was working on it this morning and wanted to share it somewhere.

Basically, if the user has selected a top-level menu item and proceeds to add a submenu item, the Navigator would only show subnav ability. So from this modal, the user still would not be able to add any top-level items because they've selected the subnav interaction.

subnav

@karmatosed
Copy link
Member

I wonder if just positioning works over limiting? An example being if the default is just to position the navigation item where you enter, then we don't need limiting. I think it's fine if someone decides to then just start building from the interface as there's already some evidence it's easier.

It's all worth testing because it could cause cognitive friction limiting and it could cause friction. not, insights will tell that.

One point, this specific issue. isn't about where it's placing as much as the editing of new menu items, I totally get those that's a macro part of a larger flow. Here is what I think we can distil down to the simplest form of editing, just typing into the link name like text.

2020-04-23 20 48 39

This needs to be then thought of how it could work with rearranging once that is added, but it solves the problem of default link names through the block navigator. Later we can build up the experience.

@karmatosed karmatosed added Needs Design Feedback Needs general design feedback. and removed Needs Design Needs design efforts. labels Apr 23, 2020
@karmatosed karmatosed added Needs Dev Ready for, and needs developer efforts and removed Needs Design Feedback Needs general design feedback. labels Apr 23, 2020
@adamziel
Copy link
Contributor

@karmatosed this has Needs Dev feedback but after reading the description and all the comments I don't have a good understanding of how this should work exactly - would you mind elaborating? E.g. How to switch between editing the text and the link? Should this include the suggestions box?

@karmatosed
Copy link
Member

karmatosed commented Apr 24, 2020

Thanks for digging a bit more into this @adamziel. Ideally, it would have the field editable when you click in. Is that a component that's possible over having a button to edit? In this sense, the text is more like the 'add link' placeholder for navigation. Here is a step-through that hopefully clarifies a little more:

2020-04-24 16 50 22

The interaction is just the same as when you add a link in the navigation block, they both should be same, add text and you can edit it.

@noisysocks noisysocks removed the [Priority] High Used to indicate top priority items that need quick attention label Apr 26, 2020
@adamziel adamziel self-assigned this Apr 27, 2020
@talldan
Copy link
Contributor

talldan commented Apr 28, 2020

Ideally, it would have the field editable when you click in. Is that a component that's possible over having a button to edit?

Click is currently used to select the block from the navigator, so might have to think about how to incorporate both editing and selecting.

Another thing I've had on my mind about this feature is that adding a link is an important aspect of the navigation block, and so I'm not sure how that could be included here, or even whether it needs to be. If it's not included, I think that makes being able to select a block more important so that a user can add a link in the main block interface.

@talldan
Copy link
Contributor

talldan commented Apr 28, 2020

In terms of the implementation, I also had some thoughts on that!

It could be interesting to try using a slot/fill in the edit function:

edit( { attributes } ) {
    return (
        // ...
        <NavigatorEdit>
            <RichText
                value={ label }
                onChange={ ( labelValue ) =>
                    setAttributes( { label: labelValue } )
                }
                placeholder={ itemLabelPlaceholder }
            />
        </NavigatorEdit>
        <NavigatorView>
            <RichText.Content
                value={ label }
            />
        </NavigatorView>
        // ...
    );
}

@adamziel
Copy link
Contributor

Still miles to go but I started a PR #21948

@karmatosed
Copy link
Member

Another thing I've had on my mind about this feature is that adding a link is an important aspect of the navigation block, and so I'm not sure how that could be included here, or even whether it needs to be. If it's not included, I think that makes being able to select a block more important so that a user can add a link in the main block interface.

@talldan as this interface is going to be used for the sub-navigation it will need ability to add.

@talldan
Copy link
Contributor

talldan commented Apr 29, 2020

as this interface is going to be used for the sub-navigation it will need ability to add.

@karmatosed That's not quite what I meant. I meant that in the designs above only the text for the link is being set, it doesn't take into account the href.

@adamziel
Copy link
Contributor

v1 which only allows editing the actual text is ready for review: #21948

Also, I share the same concern as @talldan - would #21372 fix it?

@karmatosed
Copy link
Member

I'm going to take a step back and ask a question which may change how we approach this. Currently, in the sidebar the navigation adding a link doesn't add an actual link, it just adds text:

image

How is this different from the existing instance? From my understanding, what is being suggested is being able to edit that, however, with sub-navigation using it this would also be in that instance.

I'll review #21948 as that feels like a step towards. I also will work on a full flow for #21372, it's yes part of that, however we need to be able to edit the navigation link in order to have the full experience.

@adamziel
Copy link
Contributor

adamziel commented May 4, 2020

Just capturing this alternative direction here: #21727 (comment)

@noisysocks
Copy link
Member

#22210 is sufficient to close this.

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] List View Menu item in the top toolbar to select blocks from a list of links. Needs Dev Ready for, and needs developer efforts
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants