-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Reconsider placeholder state for the Link block #28440
Comments
I'd love to work with you on this! The duelling popovers is just boxes in boxes. Additionally, the combination of a URL and URL label means it's hard to know what you're editing and when. Your instinct here, to provide a setup state for the link button, I think is a great instinct. But I think we can both expand this to other blocks that are "button containers", like Social Links and Buttons. In turn, this can help inform what happens when you click the empty state. Basically, when the block is "unconfigured", it has the setup state button that simply invokes the URL & Label popover, just as you show. Or in the case of social links, just the URL. This setup state could be a skeleton indicator when the container is unselected, and a label when selected, that both indicates that it's incomplete, and lets the setup state match the parent context (such as Buttons or Social Links). This would let us have a pretty clear shift between "clearly setup state" and when it's selected, which could just be a preview with placeholder text. Additional thought: once a button is configured, I wonder: should the popover appear every time you select the block? Honestly editing the menu item label isn't that good of an experience inline. If we did this, we could remove the link button from the toolbar. Alternately, we should at the very least make sure the link button shows as "toggled" when a URL is configured vs. when it isn't. This is great, Shaun, excellent work. |
I don't think so, no. Otherwise it can quickly become overwhelming having both a block toolbar and a URL popover. Also, considering submenus along with the vertical layout variation it could become difficult to select/navigate between blocks as there'd be an abundance of floating boxes to deal with. |
Spent some more time on this earlier today and came up with the following: Adding a Link Empty.Link.i1.mp4-- Adding a Page Link Empty.Page.Link.i2.mp4 |
I'm a big fan of your work here, Shaun. I believe that with this ticket you will have solved the biggest headache that exists for the navigation block, and that pieces will start to fall in place shortly after this. And not only that, you will have found an interface that will benefit also the Social Links block, as well as the Buttons blocks, who both suffer from this same problem, even if to a lesser extent. One tiny thing. Showing the container and selected block border we can definitely revisit. Even now, the "selected state" is currently a 1px solid border in the site editor, which allows that same border to grow thicker and blue when focused: Although we can look at using a gray background color as "highlight", I worry that will fail in some context, such as when the theme styles menu items to have background colors on their own. Or as with the social links block, where the highlight is largely obscured by the block itself: For that reason, and because everything else about this effort is so potent, I'd keep the selected border the same as it is in the site editor for now, and then we can look at a different highlight state separately. Make sense? I.e. something like this instead: What do you think? |
I like it, I think it could potentially help solve a few separate issues. At the same time I'm a bit nervous about adding another link UI. There's some tech debt built up around previous link interfaces, and also previous design-led efforts to unify the interfaces. Still worth trying given the positive feedback so far, devs will have to be careful about how it's implemented I think there are some edge cases to work out:
|
I definitely think there's an opportunity to reduce and combine some of these. From the work that's been done already, there have been pros and cons. That said, the pieces that are important to that particular flow are:
In that vein, I think of that link control more like "block UI" than a new popover interface. I could compare it to the caption field that pops out at the bottom when you select an image. I would also expect this same UI to be reused for both Buttons and Social Links blocks.
I don't think it needs to. I think it's okay for that to be the next step in the flow. I.e.
In that flow you've created a menu item, and you can now click the text directly in the menu item to edit it, bold or italicize it. Make sense?
Depends if it's actualy a popover or not. If it's just UI that appears when the button is selected, like the caption field on an image, Escape would just select the block. But if it is best implemented as a popover, then precedence for the behavior could potentially be found in the default block appender that appears on a new post: The "Start writing..." prompt here is effectively a button, which when clicked adds an empty Paragraph block with focus. |
Yep, though I did notice in @shaunandrews' mockup there's an edit button in the toolbar, which I think shows the UI again. I suppose in this case you could make the Text non-editable. |
Related: #24099 |
I'm going to take a stab at implementing this. Once I get it working I'll see what we can do about integrating it with the |
@georgeh even before you get anything working, I would super duper love to be involved. I'm so excited about Shaun's idea here. Ping me whenever and for whatever reason! Thank you. |
It sounds like this will solve 3 problems:
Can we solve 2 by popping the existing LinkControl on the block every time it has focus? Or at least when it has focus and the URL is not configured? And 1 can be solved without changing the way links are inserted. Also, is it intentional not to use LinkControl in the |
Working on #28440 Co-authored-by: Kerry Liu <[email protected]>
I was pairing with @georgeh today, and I had two other questions for folks:
|
Yes, I think that's something to consider. After all, until a link is configured, the menu item is virtually useless, and that uselessness is what drives the ultimate need for a more opinionated setup state.
I think there can be value in the reduction of the link control. However it might be worth just using the stock linkcontrol for the first draft of the PR, and then we can always upgrade with a followup. Sound good? |
It is my impression that there's still value in allowing you to bold or italic text inside the menu item label. However if it simplified things, I wouldn't mind if that rich text value only became available the menu item was successfully configured, i.e. that it wasn't available in the setup state.
I think that @ItsJonQ has been doing some CSS in JS work, so he could be the person to ask. #27331 is also valuable to dive into, in that light. |
@gwwar Haiii!!! The This setup was also designed to encourage a systemic way to making UI adjustments. Ideally, any UI adjustments can be accommodated through component props (e.g. Custom CSS can be done using the Style System. How these styles are "bound" to the UI is much more intentional and often clearer to trace and control. Hopefully this will reduce the amount of awkward CSS rules scattered throughout the codebase (which is the problem now). |
Gotcha @ItsJonQ! So it should be safe to use here? Do we happen to have an example PR or blog post of how we'd like to compose ui styles? I'm mostly curious of the pattern for different use cases |
I don't have one that walks through the exact process. I wrote one a while back describing the higher level mechanics of the Style System: https://g2components.wordpress.com/2020/08/31/creating-a-style-system/ The new Component System UI won't be available for a while, as we're still working on the initial integration into Gutenberg. We've learned a lot since starting integration back in Nov 2020. I'm planning on writing a more formal introduction of the project very soon (as in, my plans are to start writing today). Afterwards, I'll provide info as more of the system becomes available within Gutenberg. Hope this helps! |
Working on #28440 Co-authored-by: Kerry Liu <[email protected]>
Working on #28440 Co-authored-by: Kerry Liu <[email protected]>
Thank you Shaun and George! 👌 |
🎉 |
@shaunandrews @annezazu I'd like to either reopen this one, or create a new followup ticket, to revisit this bit: Specifically the idea that the menu item remains in a placeholder state until you have filled out both the URL, and the label. I was looking at #30111, and it became clear that the navigation block link box accepts anything you give it. If you type arbitrary text, you are meant to be searching for a page or post that you can choose from the dropdown, or create a draft with that title. For example if you type "WordPress", if you just press Enter, you will create a menu item labelled "WordPress" which links to But if you briefly use the arrow keys to touch a linked page, it will link to the item you hovered, and give it the title you used: If you just paste a hyperlink and press Enter, you get a link item that correctly links to that hyperlink, and with a label that's an "educated guess" based on the URL, but still not a good label: This behavior is at best confusing. To an extent, and this I believe is at the core of Shaun's design here: we shouldn't consider a navigation item to be complete and useful until it has both a URL and a label. I have some thoughts on how we might proceed, but would be curious about your thoughts first. |
I completely agree with you. This "placeholder problem" is that something that has come up repeatedly in FSE Outreach Testing and the chances of adding incomplete menu items (URL + label) is still quite high right now. I like the idea of having both be required. Tied to this, there are also problems like this with the current experience where if one adds a link in but then wants to change the label, it's hard to know if after changing the label the link "stuck". Here's a video for context: navigation.block.mov |
That could be a bug. I thought only named items (posts, pages) from the suggestions should pre-fill the label. Good to try a different solution that makes the process clearer though. |
Opened #30170 as a followup, focused just on the updated link dialog. |
When you add a new Link block within the Navigation block, the Link UI appears. However, if you click anywhere or generally move focus away, the Link UI disappears and its difficult to determine how to complete setting up the Link block. This leads to empty Link blocks with placeholder "Add link" text that doesn't do anything.
Empty.Links.mp4
I think it could be helpful to improve the Link block's placeholder state. For example, if you unselect a newly added Link block we could show a button to reopen the Link UI and add a URL:
Link.Placeholder.mp4
The experience for adding a Page or Post link could be adapted as well:
Page.Placeholder.mp4
The text was updated successfully, but these errors were encountered: