Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork79.2k
Decouple Modal's scrollbar functionality#33245
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
GeoSot commentedMar 2, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Please can somebody explain me the usage and the checks of this code block? if((!isBodyOverflowing&&isModalOverflowing&&!isRTL())||(isBodyOverflowing&&!isModalOverflowing&&isRTL())){this._element.style.paddingLeft=`${scrollbarWidth}px`}if((isBodyOverflowing&&!isModalOverflowing&&!isRTL())||(!isBodyOverflowing&&isModalOverflowing&&isRTL())){this._element.style.paddingRight=`${scrollbarWidth}px`} |
eef7dd0
toeac1d74
CompareUh oh!
There was an error while loading.Please reload this page.
d1d9489
to02404f7
Compare6d51216
to21dd1e4
Compare21dd1e4
to582d484
Compare54f11b1
tofc47b68
Comparealpadev commentedApr 7, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Found it:#14933 But that's not everything.. I decided to go down the rabbit hole. So let's begin:
The Thoughts: So I checked the examples in our documentation and this doesn't seem to work properly. (This is true for older Bootstrap versions too. Maybe it did at some point tho.) The result, the dialog isn't centered properly. (At least in FF and Chrome on Windows. Safari 14 and Chrome on Android is fine tho.) About In general without those extra paddings it seems to work fine for me. |
@alpadev what a lovely approach 🛩️ 129 line this._adjustDialog() is pointless for sure, cause it hidden as you told I am not sure for the other two usages (resize 304 / handleUpdate 211) And one more cherry, that is out of this scope: lines 405|407 & 414|419 seems redundant as element |
So I made a codepen for the case when the body doesn't overflow. Since I tried it on the documentation page. There is padding-right added because the body does overflow (Case There is no case for when both are overflowing or both are not overflowing. Also the |
My guess this was added so in case when you click on a static backdrop and it would do this little animation, it's not causing any scrollbars on the backdrop if it reaches outside but not sure. |
Likely related:#31845 |
ee866fe
to8538f88
CompareGeoSot commentedApr 7, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
alpadev left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Everything else LGTM 👍
js/src/util/scrollbar.js Outdated
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I wish would be me :P
In this PR I just remove the copied the code, out of modal.
It was written like this. I am trying to finish this and a new issue waits#33580 (afraid of how many tests need to tweak)
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
That animation is transform scale, and transforming any element does not affect the layout of the real DOM element 🤔 |
js/src/util/scrollbar.js Outdated
rohit2sharma95Apr 9, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I was just thinking if the value was not stored on the data attribute then why the style prop it is being removed from the element? 🤔
Since if thevalue
here:
constvalue=Manipulator.getDataAttribute(element,styleProp)
isundefined
, it means that the style prop was not added by the bootstrap and that's why should not be removed (that style prop might be present on the dom element already added by the end-user)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
you are right on this.
I will keep it as default, and we can discuss it on a next PR
0302957
toc197559
Comparealpadev commentedApr 9, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@rohit2sharma95 Check for yourself 🙂https://jsfiddle.net/z1pb7c9w/ |
c197559
to28e0101
CompareXhmikosR commentedApr 11, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@GeoSot BrowserStack tests broke. Please temporarily push any PRs that are not made from an upstream branch so that you check if everything is fine before we merge :) EDIT: NVM, it seems it was just a fluke. That being said, let's make sure BrowserStack tests pass for PRs coming from your fork. |
Uh oh!
There was an error while loading.Please reload this page.
Scorllbar. js
is the exact same code ofmodal.js
which handles all the scrollbar functionality.It is extracted, self-tested and used on Offcanvas with success, and it can be used on modal.js through methods
preview