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

Shouldn't modals be vertically centered instead of appearing at the top? #14617

Closed
pedrocatre opened this issue Sep 15, 2014 · 8 comments
Closed
Labels

Comments

@pedrocatre
Copy link

So this is not a "how to" question because this answer: http://stackoverflow.com/a/20444744/3094399 on stackoverflow allowed me to solve my issue and implement this behaviour.

The questions then are:

  • Why is modal vertically centered not the default? Seems a lot more user friendly to me and to my users. But since it seems I always find sensible defaults on bootstrap, maybe there is a very good reason behind this that I'm missing.
  • In case there is a good reason would it make sense for this to be configurable (where the modal appears in the window)?

Thanks

Edit: the stackoverflow solution I pointed to as an issue if the modal is bigger than the window. This can be fixed with a conditional statement but there is another answer that only uses HTML and CSS that works well and I think is better http://stackoverflow.com/a/24829651/3094399

@hnrch02 hnrch02 added the css label Sep 15, 2014
@cvrebert
Copy link
Collaborator

Gah, phones.

@cvrebert cvrebert reopened this Sep 15, 2014
@pedrocatre
Copy link
Author

I believe the user is more likely to have the mouse closer to the center of the window than closer to the top when they click on something that opens a modal.

Also I think it looks nicer in the center, but that is just my opinion.

Anyway, even if this cannot be said for all cases (that the users mouse would usually be closer to the modal most of the times if it was on the center), it can certainly be said in some cases.

I'm mostly looking for a reason why it could make more sense to have the modal on top instead of the middle.

@mdo
Copy link
Member

mdo commented Sep 23, 2014

Yeah, probably better to have them centered. I don't know if it's a simple CSS fix for this though. Plus, this might change some expected displays and behaviors for folks in v3.x, so for now I'm punting this to v4. Adding it to the list.

@mdo mdo closed this as completed Sep 23, 2014
@mdo mdo mentioned this issue Aug 19, 2015
jamespegg added a commit to jamespegg/bootstrap that referenced this issue Sep 6, 2015
Modals are now vertically aligned. Uses calc() to fix overflowing on
mobiles.
@morloderex
Copy link

Is this still considered for bootstrap v4?

@cvrebert
Copy link
Collaborator

@morloderex Yes, there's a TODO bullet point for this in #17021.

@smmoosavi
Copy link
Contributor

And pure css (with flex box)

@browner12
Copy link
Contributor

i don't think it's better or worse to have it in the center. just different. I don't think it detracts from usability having it at the top. maybe this can be the default behavior, but if we're going to switch this, we should provide an option to put the modal back at the top. IMHO there's definitely an argument to having it at the top and not centered.

@pedrocatre
Copy link
Author

@browner12 I agree. I don't know which option is the best to be default, maybe there is no better option and it just depends on the use case, but ideally it should be possible to change this easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants