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 List view: scroll horizontally when table overflows #45966

Merged
merged 10 commits into from
Nov 24, 2022

Conversation

MaggieCabrera
Copy link
Contributor

@MaggieCabrera MaggieCabrera commented Nov 22, 2022

What?

When we have menu sub menus the whole sidebar will have a scrollbar. This PR makes the list view the only part of the sidebar that will overflow because of this and makes some adjustments to keep spacing tight and improve UX like forcing the max width of each menu item to be the same as the sidebar width. That allows for us to see the edit buttons on the items you don't need to scroll to see without actually having to scroll :D

Closes #45446

Why?

It was a bad user experience to force the user to scroll the whole sidebar in these cases.

How?

I'm adding an extra class to target the table for the overflow and forcing a max width on the rows so the edit icon doesn't always appear at the far end of however width the table is.

Testing Instructions

Create a Menu with multiple sub menus nested and hover over them. Check that the scroll only affects the list view.

Screenshots or screencast

Before After
Screen Capture on 2022-11-23 at 10-04-57 Screen Capture on 2022-11-23 at 09-59-01

@codesandbox
Copy link

codesandbox bot commented Nov 22, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@MaggieCabrera MaggieCabrera changed the title scroll horizontally when table overflows Navigation List view: scroll horizontally when table overflows Nov 22, 2022
@MaggieCabrera MaggieCabrera self-assigned this Nov 22, 2022
@github-actions

This comment was marked as outdated.

@MaggieCabrera MaggieCabrera marked this pull request as ready for review November 23, 2022 09:06
@MaggieCabrera MaggieCabrera requested review from draganescu, getdave and scruffian and removed request for ellatrix November 23, 2022 09:06
@MaggieCabrera MaggieCabrera added the [Block] Navigation Affects the Navigation Block label Nov 23, 2022
Copy link
Contributor

@getdave getdave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this and it worked as described. It's much better.

Left some code comments which we may wish to discuss with other contributors specifically regarding how we approach branching in the CSS/visual styles.


.block-editor-list-view-leaf {
display: block;
max-width: $sidebar-width - (2 * $grid-unit-20);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does 2 * $grid-unit-20 represent? Sidebar padding? If so shall we make a Sass var to represent that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's sidebar padding, I just used the same var that the actual sidebar was using, since it's not defining one itself!

Copy link
Contributor

@getdave getdave Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's weird. I just see this and think "oh that represents something but I'm not sure what".

If it was a var $sidebar-padding I wouldn't have to interpret the code and it would be more readable.

I think we should do it but it's up to you 🙇

@getdave
Copy link
Contributor

getdave commented Nov 23, 2022

Feel free to ping me again when you're ready for a re-review.

@MaggieCabrera
Copy link
Contributor Author

I still need the extra div because the class needs to go outside the table element, but I'm only using the new classes to style it. I don't think we need to remove or change the spacing for the icons now, so I removed that as well:

Screenshot 2022-11-23 at 15 46 51


.offcanvas-editor-list-view-leaf {
display: block;
// sidebar width - tab panel padding
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Contributor

@getdave getdave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Thanks for being receptive to all the feedback nits 🤝

@getdave
Copy link
Contributor

getdave commented Nov 24, 2022

@MaggieCabrera Looks like we have some random static analysis errors. I re-ran the tests but if it doesn't pass you might want to rebase first.

@MaggieCabrera MaggieCabrera merged commit 46a28eb into trunk Nov 24, 2022
@MaggieCabrera MaggieCabrera deleted the offcanvas-wide-sidebar branch November 24, 2022 15:33
@MaggieCabrera
Copy link
Contributor Author

Tests passed, I'm merging this, but we can revisit if there are any other design/UX concerns @SaxonF

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 Needs User Documentation Needs new user documentation [Type] Experimental Experimental feature or API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Navigation List View: Handle the wide sidebar
5 participants