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: Add max height to dialog's content to prevent cut off #2815

Merged
merged 2 commits into from
Mar 31, 2021

Conversation

fluiddot
Copy link
Contributor

@fluiddot fluiddot commented Mar 29, 2021

Fix

Fixes: #2750

If a dialog overflows the height of the window, the content of the dialog is cut off.

max-height-dialog-content.mp4

Test

  1. Click the Menu button.
  2. Click the "Keyboard Shortcuts" button.
  3. Zoom in the window a couple of times (can be done via View/Zoom In).
  4. Decrease the height of the browser window until it's smaller than the dialog height.
  5. Observe that the dialog's content is not cut off and can be scrolled.

Release

Fixed cut off issue for dialogs when the window is too small.

@fluiddot fluiddot added the bug Something isn't working label Mar 29, 2021
@fluiddot fluiddot requested a review from sandymcfadden March 29, 2021 14:32
@@ -39,6 +39,7 @@
display: flex;
flex-direction: column;
flex: 1 0 auto;
max-height: calc(100vh - 56px - 20px);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The max height of the content view is calculated by subtracting the header height (56px) and some padding (20px) to the window height (100vh).

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks so much for diving in and starting on fixes!
There are a couple of small things. In a previous PR, I was working on one dialog in particular and took a similar approach to what you did here to set the max height. It was decided instead that we could use a height of 420px as the max instead.
The dialog in your video works well as one of the inner elements of the dialog has an overflow set for it. For other dialogs this can cause the content to overflow out of it. Would be good to add an overflow: auto; to this as well.
Not sure how far you want to go with this but #2777 is sort of related to this as well.
The plan was to have the entire height of the dialog be a max of 420px, then have the inner content be scrollable if needed. The header, and if there were any action buttons with the dialog at the bottom, would remain static and always visible without scrolling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a couple of small things. In a previous PR, I was working on one dialog in particular and took a similar approach to what you did here to set the max height. It was decided instead that we could use a height of 420px as the max instead.

I just checked that the minimum window is set to 520px so 420px should be enough. However the content is still cut off if you zoom in the UI (see attached video), as far as I checked the only way to prevent it is by using the viewport height with vh unit 😞 .

dialog-content-zoom-in.mp4

The dialog in your video works well as one of the inner elements of the dialog has an overflow set for it. For other dialogs this can cause the content to overflow out of it. Would be good to add an overflow: auto; to this as well.

Good point! I think it would be a great idea to add overflow to the content view, this way we assure that it's always scrollable.

Another thing it would be interesting is to review the dialogs and set overflow to the sections that would require it. As an example, I'm working on this issue related UnsynchronizedConfirmation dialog and here I think makes more sense to make the changes list scrollable not the whole content (check follow video).

unsynchronized-dialog-overflow.mp4

Not sure how far you want to go with this but #2777 is sort of related to this as well.

I'm still getting familiar with the project but I can take a look if you want.

Copy link
Contributor Author

@fluiddot fluiddot Mar 29, 2021

Choose a reason for hiding this comment

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

One option I'm considering, although I'm not sure about potential compatibility issues, is to use this for calculating the max height:
max-height: unquote('min(100vh - 20px, 420px)');.

This will allow us to set the maximum height to 420px but if for any reason the window gets smaller (looks like this is what's happening when zooming in), we use the window height to prevent the cut off.

Note the use of unquote for prevent using the Sass's min function because it doesn't support vh units.

Copy link
Contributor

Choose a reason for hiding this comment

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

Using the min function seems like a good approach to me here to get the 420px height, but also ensure it works on zoomed in views.

My thoughts on #2777 were very similar to what you're thinking about for the UnsynchronizedConfirmation dialog.

Copy link
Contributor Author

@fluiddot fluiddot Mar 30, 2021

Choose a reason for hiding this comment

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

After a second thought, I decided to use media queries instead of this approach because it looks way safer (related commit).

EDIT: I've also updated the video from the description.

@@ -39,6 +39,7 @@
display: flex;
flex-direction: column;
flex: 1 0 auto;
max-height: calc(100vh - 56px - 20px);
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks so much for diving in and starting on fixes!
There are a couple of small things. In a previous PR, I was working on one dialog in particular and took a similar approach to what you did here to set the max height. It was decided instead that we could use a height of 420px as the max instead.
The dialog in your video works well as one of the inner elements of the dialog has an overflow set for it. For other dialogs this can cause the content to overflow out of it. Would be good to add an overflow: auto; to this as well.
Not sure how far you want to go with this but #2777 is sort of related to this as well.
The plan was to have the entire height of the dialog be a max of 420px, then have the inner content be scrollable if needed. The header, and if there were any action buttons with the dialog at the bottom, would remain static and always visible without scrolling.

@fluiddot fluiddot requested a review from sandymcfadden March 30, 2021 16:36
Copy link
Contributor

@sandymcfadden sandymcfadden left a comment

Choose a reason for hiding this comment

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

I left one comment about the use of interpolation, but other than that this looks good, thank you! I like the media query approach.
This tests well on all the dialogs I tried where it doesn't fall out of the screen and I can access all the content in it.

@fluiddot fluiddot added this to the 2.10.0 milestone Mar 31, 2021
@fluiddot fluiddot merged commit b4dd9f0 into develop Mar 31, 2021
@fluiddot fluiddot deleted the fix/dialog-content-max-height branch March 31, 2021 16:44
@fluiddot fluiddot self-assigned this Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modals become obscured in short windows or with zoomed UI
2 participants