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

Fix accounts menu styling #8707

Merged
merged 2 commits into from
Jun 1, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions ui/app/components/app/account-menu/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@

&__accounts-container {
display: flex;
position: relative;
flex-direction: column;
z-index: 200;

@media screen and (max-width: 575px) {
Copy link
Member

Choose a reason for hiding this comment

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

Why screen and max-width? This is a height issue. And why 575px? The popup has a height of 600px, but it looks like the menu is cut off until it gets above ~625px or so

Suggested change
@media screen and (max-width: 575px) {
@media (max-height: 625px) {

Copy link
Member Author

Choose a reason for hiding this comment

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

I just followed the other media queries in the file, all of which seem to be about handling the popup UI, and all of which use @media screen, and then max-width or min-width. See: https://github.com/MetaMask/metamask-extension/blob/develop/ui/app/components/app/account-menu/index.scss

Copy link
Member Author

@rekmarks rekmarks Jun 1, 2020

Choose a reason for hiding this comment

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

In fact, there are 177 existing media queries in our code base, and ~175 of them use @media screen and [max-|min-]width. If max-width, the value is (almost?) always 575px.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what that has to do with this situation; I don't know what each of those are intended for. The other examples in this file of setting max-height in a max-width media query block also seem strange to me, but it's hard to say without knowing what they're intended to do.

Copy link
Contributor

Choose a reason for hiding this comment

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

imo we'd target height here in the media query. It seems like having a discussion on media query formats and pulling those queries into some variables in SCSS would be a good idea in the long term.

Copy link
Member Author

Choose a reason for hiding this comment

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

Very well; although I think we can pretty safely say that the purpose of those media queries is to apply styles to the popup UI, since their effect is to apply styles to the popup UI, and we'd expect to see such queries all over the codebase.

Whatever the case, we can address it later like Brad suggested.

Changed to max-height: 600px query in b98e0a9, since 600px is the height of the popup UI. It works.

Copy link
Member

Choose a reason for hiding this comment

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

This is certainly an improvement, but it still leaves the Settings menu option obscured when the window is between 600px and 625px, as uncommon as those heights may be.

If we would prefer keeping the media queries restricted to certain screen sizes to simplify testing, we could pursue alternate solutions like setting a max-height based upon the viewport height.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, now I see what you mean. Sorry about that. I'll create an issue attempting to document these concerns. Ref: #8711

max-height: 236px;
}
}

&__accounts {
Expand Down Expand Up @@ -160,10 +165,6 @@
cursor: pointer;
}

&__accounts-container {
position: relative;
}

&__scroll-button {
position: absolute;
bottom: 12px;
Expand Down