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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncates modal to fit content and centers #3982

Merged
merged 1 commit into from
Sep 15, 2021

Conversation

petesfrench
Copy link
Contributor

@petesfrench petesfrench commented Sep 14, 2021

Done

  • Truncates modal to fit where the content ends and centers the modal when viewing on mobile.

Fixes #3906

QA

  • Open demo
  • Check the modal works as expected and that it limits the size to fit that of the content.

Check if PR is ready for release

If this PR contains Vanilla SCSS code changes, it should contain the following changes to make sure it's ready for the release:

  • PR should have one of the following labels to automatically categorise it in release notes:
    • Feature 馃巵, Breaking Change 馃挘, Bug 馃悰, Documentation 馃摑, Maintenance 馃敤.
  • Vanilla version in package.json should be updated relative to the most recent release, following semver convention:
    • if CSS class names are not changed it can be bugfix relesase (x.x.X)
    • if CSS class names are changed/added/removed it should be minor version (x.X.0)
    • see the wiki for more details
  • Any changes to component class names (new patterns, variants, removed or added features) should be listed on the what's new page.
  • Documentation side navigation should be updated with the relevant labels.

Screenshots

Screenshot from 2021-09-14 12-18-11

@webteam-app
Copy link

Demo starting at https://vanilla-framework-3982.demos.haus

@lyubomir-popov
Copy link
Contributor

lyubomir-popov commented Sep 14, 2021

@bartaz one concern with the centering - what happens when, as a result of interaction, the height changes? this would jump to a different position.Should we have a version of this that is positionable in a fixed way, so that it doesn't move if you tick a checkbox and it reveals a couple more fields.

@bartaz
Copy link
Contributor

bartaz commented Sep 14, 2021

@bartaz one concern with the centering - what happens when, as a result of interaction, the height changes? this would jump to a different position.Should we have a version of this that is positionable in a fixed way, so that it doesn't move if you tick a checkbox and it reveals a couple more fields.

@lyubomir-popov We can fix it ourselves to the top (as it was before) without making it full screen. But it's also as easy as setting top in CSS or JS. So we can describe it in the docs.
But in such case we should have a recommendation - when dialogs should be aligned to the top and when not? Maybe for simplicity always align them from top?

@lyubomir-popov
Copy link
Contributor

lyubomir-popov commented Sep 14, 2021

I'd say pick an optimum max height for the panel, and center that - then expand until you reach it, as needed.

So if your panel will expand from 300px to say 600px, and you're doing the positioning via js - calculate your top offset so that the final 600px height would appear centered. This means initially the 300px panel will be 300px above the vertically centered position, which is fine.

Copy link
Contributor

@bartaz bartaz left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks

@petesfrench petesfrench merged commit 27752b2 into canonical:master Sep 15, 2021
@petesfrench petesfrench deleted the Bugfix-#3906 branch September 15, 2021 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mobile modal should not take whole screen
4 participants