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

fix(Modal): fix positioning when "as" prop is a component #2623

Merged
merged 2 commits into from
Mar 18, 2018
Merged

fix(Modal): fix positioning when "as" prop is a component #2623

merged 2 commits into from
Mar 18, 2018

Conversation

trevorharwell
Copy link
Contributor

@trevorharwell trevorharwell commented Mar 8, 2018

I found that when I use <Modal as={SomeComponent} /> in React 16, the modal positioning broke. This is an easy and straight forward way to remedy the problem. Let me know if there is an alternative approach that I should be taking.

Re Testing: I didn't see any tests that covered this particular function so I didn't add any. If that is desired I can try to figure something out.

@welcome
Copy link

welcome bot commented Mar 8, 2018

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Run yarn lint locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.
  • Run yarn test locally to catch errors. This ensures all components still behave as they should.
  • Run yarn start to run the doc site locally and try a few pages, ensuring everything is in good working order.
  • Include tests when adding/changing behavior.

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

@trevorharwell trevorharwell changed the title Add check to make sure ref is in fact an element Fix Modal positioning when "as" prop is a component Mar 8, 2018
@codecov-io
Copy link

codecov-io commented Mar 8, 2018

Codecov Report

Merging #2623 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2623   +/-   ##
=======================================
  Coverage   99.74%   99.74%           
=======================================
  Files         160      160           
  Lines        2751     2751           
=======================================
  Hits         2744     2744           
  Misses          7        7
Impacted Files Coverage Δ
src/modules/Modal/Modal.js 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7284aa...ae0323a. Read the comment docs.

@trevorharwell
Copy link
Contributor Author

Now that I have had some time to think about this, I believe this could be easily solved by wrapping the content element in a Ref component and using that to set the ref. Would that be something you guys would approve?

@layershifter layershifter changed the title Fix Modal positioning when "as" prop is a component fix(Modal): fix positioning when "as" prop is a component Mar 11, 2018
@layershifter
Copy link
Member

layershifter commented Mar 11, 2018

@trevorharwell thanks for PR 👍

In fact, we have a quite stale #2306, that should solve this problem for all components. As current solution, we can accept PR that will use <Ref /> for refs and add a TODO for future removal.

@trevorharwell
Copy link
Contributor Author

@layershifter Thanks for getting back to me. I updated the PR per your request. Let me know if there is anything else I should do.

FYI we use SUIR for a large scale web application at my company and we love it! Thanks for such a great library!

@levithomason levithomason self-requested a review March 16, 2018 06:19
@levithomason
Copy link
Member

@layershifter this looks OK to me for a short-term fix, merge at will. Perhaps we should add these TODOs to #2306 so we remember to clean them up.

@levithomason levithomason merged commit 7ac06c4 into Semantic-Org:master Mar 18, 2018
@welcome
Copy link

welcome bot commented Mar 18, 2018

Congrats on merging your first pull request! 🎉🎉🎉

robot victory dance

@trevorharwell trevorharwell deleted the feature/th/fix-modal-with-component-element-type branch March 19, 2018 14:46
@levithomason
Copy link
Member

Released in semantic-ui-react@0.79.0.

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.

4 participants