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 not centered and sit out of the screen #2558

Closed
omar-bz opened this issue Feb 22, 2018 · 6 comments
Closed

Modal not centered and sit out of the screen #2558

omar-bz opened this issue Feb 22, 2018 · 6 comments

Comments

@omar-bz
Copy link

omar-bz commented Feb 22, 2018

Hi, I dont know if this an issue but the modal examples are not working, a modal has a top margin -104px and not centered :
the code:

import React from 'react';
import { Button, Header, Image, Modal } from 'semantic-ui-react';
import 'semantic-ui-css/semantic.min.css';

const ModalModalExample = () => (
  <Modal trigger={<Button>Show Modal</Button>}>
    <Modal.Header>Select a Photo</Modal.Header>
    <Modal.Content image>
      <Image
        wrapped
        size="medium"
        src="/assets/images/avatar/large/rachel.png"
      />
      <Modal.Description>
        <Header>Default Profile Image</Header>
        <p>
          We've found the following gravatar image associated with your e-mail
          address.
        </p>
        <p>Is it okay to use this photo?</p>
      </Modal.Description>
    </Modal.Content>
  </Modal>
);

export default ModalModalExample;

the image:
image

@welcome
Copy link

welcome bot commented Feb 22, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@siimots
Copy link

siimots commented Feb 22, 2018

Duplicate #2549

@anztrax
Copy link

anztrax commented Mar 10, 2018

you can solve it with styling the Modal component.

style :


const inlineStyle = {
  modal : {
    marginTop: '0px !important',
    marginLeft: 'auto',
    marginRight: 'auto'
  }
};

react component :

<Modal dimmer={dimmer}
             open={open}
             onClose={this.handleOnClose}
             style={inlineStyle.modal}>

hope that can help temporarily 😅

@JohnPochta
Copy link

@anztrax , i LOVE U!
Thank you very much!

@loopmode
Copy link

loopmode commented Mar 27, 2018

@anztrax suggestion didn't center the modal vertically for me.

Apparently, it's just a .transition.visible {display: block!important} that's causing the troubles. I prefer this workaround for now:

.ui.page.modals.transition.visible {
    display: flex !important;
}

update: meh. Doesn't work when you have a max-height for the modal content.

@rztiwari
Copy link

I too had similar issues besides had to position the modal on the center vertically. I had made the changes above mentioned by @anztrax. Also added the override to modal as below:

.ui.modal {
margin-top: 0 !important;
}
Which allows the content to be place vertically centered with dynamic content as well

@Semantic-Org Semantic-Org locked as resolved and limited conversation to collaborators May 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants