Skip to content

Scrollable modal - #27769

Merged
XhmikosR merged 6 commits into
twbs:v4-devfrom
ysds:scrollable-modal
Jan 20, 2019
Merged

XhmikosR merged 6 commits into
twbs:v4-devfrom
ysds:scrollable-modal

Conversation

@ysds

@ysds ysds commented Dec 5, 2018 •

Copy link
Copy Markdown
Contributor

This feature is inspired by MDC Dialog.

The scrollable modal allows scrolling the modal body. The standard model height fits to own content height, but the scrollable modal fits within the viewport height if the content is too long.

image

demo: https://deploy-preview-27769--twbs-bootstrap4.netlify.com/docs/4.2/components/modal/#scrolling-long-content

Cheers!

@ysds
ysds requested review from a team as code owners December 5, 2018 02:11
Comment thread js/src/modal.js Outdated
Comment thread scss/_modal.scss Outdated
Comment thread scss/_modal.scss Outdated
Comment thread scss/_modal.scss Outdated

@Johann-S Johann-S left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a unit test please ?
Otherwise LGTM 👍

@ysds

ysds commented Dec 6, 2018

Copy link
Copy Markdown
Contributor Author

I'm not very familiar with QUnit. I'd like to ask your support 🙏

@Johann-S

Johann-S commented Dec 6, 2018

Copy link
Copy Markdown
Member

@ysds you have to check when you a modal is shown, if this modal has .modal-dialog-scrollable class, the modal body scrollTop property should be equal to 0

@ysds
ysds force-pushed the scrollable-modal branch from 42330be to 6b81006 Compare December 6, 2018 15:02
@MartijnCuppens

Copy link
Copy Markdown
Member

@ysds, you'll need to add a test to this file: https://github.com/twbs/bootstrap/blob/v4-dev/js/tests/unit/modal.js
The scenario Johann describes should be a good test. I think you'll find out how the tests work if you look at other tests, but if encounter problems with it, let us know.

@tmorehouse

Copy link
Copy Markdown
Contributor

I wonder if the scrollable content should be default behaviour on vertically centered modals?

@ysds

ysds commented Dec 14, 2018

Copy link
Copy Markdown
Contributor Author

@Johann-S I think that test result will always be OK, because the initial scrollTop of a modal body is 0. After creating a modal that overflows the height of the viewport, then it is necessary to change the scroll potion. How can I define a modal that overflows the height of the viewport? What is the height of the viewport in the test?

(I have never written a Qunit test script)

@Johann-S

Copy link
Copy Markdown
Member

@ysds it seems not see: https://coveralls.io/builds/20490418/source?filename=js/src/modal.js#L251
If it was the case this line would be covered.

You have to create a modal with a height greater than window.outerHeight to overflow the height of the viewport.
A QUnit test or a unit test in a DOM, is the same as writting JS, you have to create the HTML a be sure your logic works

@ysds

ysds commented Dec 14, 2018

Copy link
Copy Markdown
Contributor Author

Done. I had some misunderstanding. It seems there was no need to get the viewport height.

MartijnCuppens
MartijnCuppens previously approved these changes Dec 19, 2018

@MartijnCuppens MartijnCuppens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The css LGTM

@Johann-S Johann-S left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍

@XhmikosR

Copy link
Copy Markdown
Member

Rebased.

Comment thread site/docs/4.2/components/modal.md Outdated
Comment thread scss/_modal.scss Outdated
@XhmikosR

XhmikosR commented Jan 9, 2019

Copy link
Copy Markdown
Member

@mdo: Is there something else we need here or can we merge?

@ysds

ysds commented Jan 9, 2019 •

Copy link
Copy Markdown
Contributor Author

Please wait to merge! I found a better workaround for the strange scrollbar behavior on IE.

@ysds
ysds force-pushed the scrollable-modal branch from a289559 to cfb45ac Compare January 9, 2019 14:13
@ysds

ysds commented Jan 9, 2019

Copy link
Copy Markdown
Contributor Author

I changed the modal.css only and force-pushed. Sorry but please review again 🙏

@MartijnCuppens
MartijnCuppens dismissed their stale review January 11, 2019 12:45

Latest changes not reviewed yet

@mdo mdo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Excited for this! Thank you <3.

@mdo mdo mentioned this pull request Jan 20, 2019
@XhmikosR
XhmikosR merged commit de0bb1e into twbs:v4-dev Jan 20, 2019
@ysds
ysds deleted the scrollable-modal branch March 12, 2019 03:25
benouat pushed a commit to ng-bootstrap/ng-bootstrap that referenced this pull request Jun 24, 2019
Introduces the new modal feature behind twbs/bootstrap#27769.
Setting the option `scrollable: true` will add the corresponding bootstrap class `.modal-dialog-scrollable`
mijohnsmith pushed a commit to mijohnsmith/ng-bootstrap that referenced this pull request Jun 27, 2019
Introduces the new modal feature behind twbs/bootstrap#27769.
Setting the option `scrollable: true` will add the corresponding bootstrap class `.modal-dialog-scrollable`
lupinthethirdgentleman pushed a commit to lupinthethirdgentleman/angular-bootstrap that referenced this pull request Aug 5, 2021
Introduces the new modal feature behind twbs/bootstrap#27769.
Setting the option `scrollable: true` will add the corresponding bootstrap class `.modal-dialog-scrollable`
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.

7 participants