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

Modal: fix overflow on mobile when content too large #1066

Merged
merged 10 commits into from
Feb 10, 2023

Conversation

LostABike
Copy link
Contributor

@LostABike LostABike commented Feb 8, 2023

Changes

Added max-height to iui-dialog-content because the content was going out of screen/overflow for smaller screens.

image

This is not a complete PR. The issue with setting max-height for dialog content is that in the case of full screen, it would affect the position of the buttons, because they are placed below the content and not relative to the full page (I might be overthinking this and that it is on the user to place their buttons to the right position...)

image

Alternatively, I tried setting max-height to inherit instead, which I think makes sense to have content min-height inherit from parents which is the dialog box that contains it, and that works for full screen. However because the content position is a bit below the dialog box, this is what happens

image

So a possible solution would be to do something like max-height: inherit - 20px, basically says content max-height is whatever the parent (dialog container) max-height is, but a bit smaller. But inherit - something is not a thing. Is something equivalence to that?

closes #425

Testing

Docs

@FlyersPh9
Copy link
Collaborator

I pulled this branch locally and ran it in the iOS Simulator to investigate.

I think part of the reason we're facing this issue is because the default dialog does not have display: flex set. After adding these 2 lines & removing 1 line, it appears to fix the issue:

@mixin iui-dialog {
+ display: flex;
+ flex-direction: column;
  ...
}

@mixin iui-dialog-content {
  …
- max-height: 70vh;
}

If we add that, we could then remove those duplicated lines within @mixin iui-dialog-full-page & @mixin iui-dialog-draggable.

However, I think there was a reason we didn't do this. Would changing the default dialog from display: block to display: flex be considered a breaking change?

@mayank99
Copy link
Contributor

mayank99 commented Feb 9, 2023

@FlyersPh9 See above where I said:

I just realized we didn't add display: flex on the regular dialog to keep backwards compatibility with an older version where Dialog.Content was optional.

@LostABike LostABike marked this pull request as ready for review February 9, 2023 22:02
@LostABike LostABike requested a review from a team as a code owner February 9, 2023 22:02
@LostABike LostABike requested a review from a team February 9, 2023 22:02
@LostABike LostABike added this pull request to the merge queue Feb 10, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 10, 2023
@mayank99 mayank99 changed the title Annie/phone modal display too large Modal: fix overflow on mobile when content too large Feb 10, 2023
@mayank99 mayank99 added this pull request to the merge queue Feb 10, 2023
Merged via the queue into main with commit d3844a0 Feb 10, 2023
@mayank99 mayank99 deleted the annie/phone-modal-display-too-large branch February 10, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modal appears larger than phone display
3 participants