carbon-components-angular
carbon-components-angular copied to clipboard
fix(modal): fix rounding issue in shouldShowScrollbar
shouldShowScrollbar uses scrollHeight to determine whether the modal content is scrollable or not. The problem is that scrollHeight returns a rounded value, and its implementation (round up or down) is browser-specific. For text elements, with the default Carbon styles, the modal content height is 28.02 px. Different browsers may return different values. e.g.:
- Chrome seems to always return
28. - FireFox returns
28for some languages (e.g. English), but returns29for some other languages (e.g. Chinese).
The previous implementation uses Math.round to round getBoundingClientRect().height before comparison. This results in false positive for some languages like Chinese. It seems we should use Math.ceil instead.
Before:
After:
Deploy Preview for carbon-components-angular ready!
| Name | Link |
|---|---|
| Latest commit | 6e99cee76cbd15bdaaa99ec76bbe0eaede470a43 |
| Latest deploy log | https://app.netlify.com/sites/carbon-components-angular/deploys/63039be55757610008d4a4da |
| Deploy Preview | https://deploy-preview-2214--carbon-components-angular.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
:tada: This PR is included in version 4.59.11 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This PR is included in version 5.0.6 :tada:
The release is available on:
Your semantic-release bot :package::rocket: