question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modal is not centered and trunked at the top

See original GitHub issue

Hello,

I’m using semantic ui for react and I’ve a issue concerning the modal displaying.

When it opens, the modal appears at the top left corner of my screen and it’s not centered (vertically or horizontaly).

[Modal] should be center both horizontally and vertically

Version

“semantic-ui-css”: “^2.3.0”, “semantic-ui-react”: “^0.78.3”

image

The used code:

constructor() {
    super();
    this.state = { open: false };
    this.showLogin = this.showLogin.bind(this);
    this.closeLogin = this.closeLogin.bind(this);
  }
  showLogin(dimmer) {
    this.setState({ dimmer, open: true })
  }
  closeLogin() {
    this.setState({ open: false })
  }
 componentDidMount() {
    this.showLogin('blurring');
  }
  render() {
    const { open, dimmer } = this.state;
    return (
      <div>
        <Modal dimmer={dimmer} open={open} onClose={this.closeLogin}>
          <Modal.Header className="ui center aligned">Select a Photo</Modal.Header>
          <Modal.Content>
            <Modal.Description>
              <Header>Default Profile Image</Header>
              <p>Weve 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.Actions>
            <Button color='black' onClick={this.closeLogin}>
              Nope
            </Button>
            <Button positive icon='checkmark' labelPosition='right' content="Yep, that's me" onClick={this.closeLogin} />
          </Modal.Actions>
        </Modal>

      </div>
    );
  }

I’m posting here because you ask posting all css issues on the semantic ui repo and not on the react one.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:22 (4 by maintainers)

github_iconTop GitHub Comments

33reactions
christophedebatzcommented, Mar 14, 2018

A small hotfix with css for thus interested…

.visible.transition {
  margin-top: auto !important;
  display: inline-block !important;
  position: relative;
  top: 20%;
}
10reactions
elliscommented, Aug 3, 2018

@lazdinst Thanks for that tip - npm install semantic-ui-css@2.2.14 did the trick for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vertically centering Bootstrap modal window - Stack Overflow
I used "margin-top" instead of transform. ... before positioning, otherwise $dialog.height() will be 0 and the modal will not be centered completely.
Read more >
wxDialog Class Reference - wxWidgets
Shows a dialog modal to the parent top level window only. Unlike ShowModal(), dialogs shown with this function only prevent the user from...
Read more >
IPSC: Site Trunking 101 - IN.gov
When a site goes into Site Trunking, a series of reporting and corrective actions automatically begins. You do not need to contact IPSC....
Read more >
How to Align modal content box to center of any screen?
Example 1: First, we will design modal content for the sign-up then by using CSS we will align that modal centered(vertically). Using the ......
Read more >
Calvin Klein Body Modal Trunk Arctic Night U5554F-4AN
This product is sold out and currently not available. The Calvin Klein Micro Modal Trunk has all the millennial amenities the modern man...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found