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): prevent resize loop for full screen height #3024

Merged
merged 4 commits into from
Aug 7, 2018
Merged

fix(Modal): prevent resize loop for full screen height #3024

merged 4 commits into from
Aug 7, 2018

Conversation

marcdavi-es
Copy link
Contributor

@marcdavi-es marcdavi-es commented Jul 20, 2018

This fixes the bug reported here.

My assumptions:

  1. It is a good thing to allow consumers of Modal to override the full screen modal to fill the height of the screen.
  2. The change does not materially affect the existing functionality. The scrolling class will continue to be set on modals which are larger than window.innerHeight.

@welcome
Copy link

welcome bot commented Jul 20, 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.

@codecov-io
Copy link

codecov-io commented Jul 20, 2018

Codecov Report

Merging #3024 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3024      +/-   ##
==========================================
+ Coverage   99.96%   99.96%   +<.01%     
==========================================
  Files         163      163              
  Lines        2738     2743       +5     
==========================================
+ Hits         2737     2742       +5     
  Misses          1        1
Impacted Files Coverage Δ
src/modules/Modal/Modal.js 100% <100%> (ø) ⬆️
src/modules/Popup/Popup.js 100% <0%> (ø) ⬆️
src/modules/Rating/RatingIcon.js 100% <0%> (ø) ⬆️

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 4295b56...9975a34. Read the comment docs.

@@ -252,7 +252,7 @@ class Modal extends Component {
// SEE: https://github.com/Semantic-Org/Semantic-UI/issues/6185#issuecomment-376725956
// const marginTop = -Math.round(height / 2)
const marginTop = null
const scrolling = height >= window.innerHeight
const scrolling = height > window.innerHeight
Copy link
Member

Choose a reason for hiding this comment

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

This is great, thanks! Let's fix the test which is currently too loose:

it('adds the scrolling class to the body when taller than the window', (done) => {

Perhaps we can split this into two tests. One that it('does not add the scrolling class to the body when equal to the window height') and leave the current test. This new test could set an inline style on the Modal to match the window height that is already set in the test.

This way, we are sure this works as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@levithomason thanks, that's done :)

@levithomason levithomason merged commit afad3c2 into Semantic-Org:master Aug 7, 2018
@welcome
Copy link

welcome bot commented Aug 7, 2018

Congrats on merging your first pull request! 🎉🎉🎉

robot victory dance

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