-
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
Let the menu grow #8756
Let the menu grow #8756
Conversation
We introduce
|
ORLY, and that linter doesn't allow Nacin-Spacin'? Who designed this thing? :D I'll fix things up. But seriously though — space after parenthesis is WordPress coding style no? |
https://make.wordpress.org/core/handbook/best-practices/coding-standards/css/#values
Weird, huh? |
I have never studied them, however, @ntwb should know why it works as it works 😃 |
Wait what when did this happen? Also CC: @pento I'M ESCALATING THIS ALL THE WAY 😂 Are we also writing "Wordpress" now? |
WHO WROTE THESE CSS CODING STANDARDS 😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡 |
We definitely |
|
As someone who advocates for coding standards that vary by language, I like the lack of spaces in our (S)CSS! 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the menu text is too long, say in a locale with long words?
@@ -42,10 +42,14 @@ | |||
stroke: $dark-gray-900 !important; | |||
fill: $dark-gray-900 !important; | |||
} | |||
|
|||
// Don't wrap text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this mean it overflows if it's too long?
height: auto; | ||
overflow-y: auto; | ||
|
||
// Let the menu scale to fit items. | ||
width: auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are literally out of alphabetical order and I find that makes them so tough to read. Not part of the coding standards though, so I gotta just live with it I guess 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what will happen if you add a really really really really long sentence, one that is larger than 360px minus the chrome, well then a horizontal scrollbar will appear in the menu. And we need the whitespace in order for the menu to grow.
From a philosophical perspective, though, I think it's okay to set "no wrapping" as a hard limit. I can't think of software where I see menu items wrapping text (* quickly flips through macos file menus to verify*). Added to that, I feel like we could also put some onus on translators to test that things look right.
That's my opinion in any case.
To be clear: I really like this and am just curious about very long names. After that's addressed I think we should 🚢 |
Without the whitespace rule, the menu can't grow — the menu grows by having a min width, a max width, and a If we were to want to address super long titles on mobile, we'd need to explicitly set a However it does feel like we're hyper optimizing for catastrophe before it's even happened. Which... I know that sounds strong and I'm REALLY not trying to dismiss any of this legitimate feedback. I'm just wondering if we should postpone fixing the theoretical issue until it's an actual issue? |
Can plugins extend this area? Totally agreed that if we have control over the text here, it's unlikely to be an issue. But if plugins can extend the popover menu, we may not have a way of monitoring when it's become an issue, beyond "people start to complain and/or stop using things." Also, if we're running on the assumption that users don't want to use WordPress via a web browser on their mobile device, this probably doesn't need to be addressed now. That may well be the case—I don't have any data here and I wouldn't be surprised if users would prefer to use the app ... but that could also be an effect of "the app is easier to use on my phone" as well, so 🙃. |
Yes, plugins can indeed extend this area. It's a solid point. I will try and see if I can figure something at least for the mobile breakpoints. |
3dddebe
to
763a1ef
Compare
So, I write some CSS to try and make the menu full width on mobile through classic responsive breakpoint work, but then I noticed a bunch of The key seems to start here: https://github.com/WordPress/gutenberg/blob/master/packages/components/src/popover/index.js#L255 ... but I'm not actually sure when this is supposed to work. Is this a prop we set on a per-component boolean? @tofumatt since you're way more skilled in this than I am, is there any chance you can take a look and see what might be up? Here's how I imagine it should work:
|
@jasmussen The I'd be very cautious to style changes there :) it affects the inserter. |
Sorry, I somehow just missed that GitHub ping. 😓 |
Like @youknowriad said: at any rate I don't think you want to use that class; I'd think you'd want to use breakpoints. I'm unclear if this is ready for another review or not, it looks the same as it did before. Feel free to ping me if there are unanswered questions. 😄 |
To clarify, this class is only added on small screens if the prop is true. So if the behavior wanted here is to make this popover fullscreen on mobile, this is the right way to do it. Use this prop. |
This PR lets the menu grow to accommodate long text. Already now in Spanish, the "Code Editor" wraps having to fit both the spanish label and keyboard shortcut. As we add more keyboard shortcuts as well as hints, we need to let the menu grow to accommodate that, up to the mobile breakpoint in width. This PR accomplishes that using auto widths, nowrap whitespace, and a little Nacin' Spacin' thrown in for code cleanup while I was there.
763a1ef
to
89cc26a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, it occurs to me: why do we even show the keyboard shortcuts on mobile? We could get a lot more use out of that space by hiding them, and keyboard shortcuts on mobile aren't super useful.
Still, this is better. Let's 🚢 , but maybe we should hide those shortcuts on mobile too. I'll make a PR for it.
@@ -41,11 +41,19 @@ | |||
// !important allows icons from plugins to be overriden and given a dark-gray fill | |||
fill: $dark-gray-900 !important; | |||
} | |||
|
|||
// Don't wrap text. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "Don't wrap text on mobile screens."?
|
||
// Don't wrap text. | ||
@include break-mobile() { | ||
.components-popover:not(.is-mobile) & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit confusing because it's used on mobile breakpoints but when :not(.is-mobile)
is true. 😕
EDIT: Nevermind, I just understood how this works and apparently @include break-mobile
works unlike how I expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "break-mobile" mixin is the confusing aspect. is-mobile
never invokes on desktop responsive viewpoints, but the mixin does as it is just a media query. So in a way this is a responsive fix, not solely a mobile fix. And given the whole behavior of the popover changes when is-mobile is present, I'd rather not interfere here.
I will clarify the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, paths crossed! Cheers 👍
The keyboard shortcuts thought is a solid idea, and worth a separate ticket. Note that there are some considerations for that — you might have a really thin viewport on the desktop, but still have access to the shortcuts. Would we want to show or hide them in this case? |
This fixes a regression introduced as part of #8756. Basically we removed the min-width so as to let the content itself expand the popover. But alas an empty textfield, like the URL input field, did not expand the popover as it should. We could look at adding the min-width to the URL input field instead, this should expand the popover, but given the fallout this min-width removal has caused already, it's probably good to keep it in place as a baseline.
This fixes a regression introduced as part of #8756. Basically we removed the min-width so as to let the content itself expand the popover. But alas an empty textfield, like the URL input field, did not expand the popover as it should. We could look at adding the min-width to the URL input field instead, this should expand the popover, but given the fallout this min-width removal has caused already, it's probably good to keep it in place as a baseline.
This PR lets the menu grow to accommodate long text. Already now in Spanish, the "Code Editor" wraps having to fit both the spanish label and keyboard shortcut. As we add more keyboard shortcuts as well as hints, we need to let the menu grow to accommodate that, up to the mobile breakpoint in width.
This PR accomplishes that using auto widths, nowrap whitespace, and a little Nacin' Spacin' thrown in for code cleanup while I was there.
Screenshots:
Affects #7433
To test, verify that there are no regressions with any menus/popover content, including the switcher and the library.