Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #32779
Closed
Open
Issue created Jan 13, 2021 by Administrator@rootContributor

Modal wrongly adding right padding due to window.innerWidth not returning the right value

Created by: yusufhm

I've been having an issue with a project, where a right padding is being adding to a full-width modal, but only on Windows Chrome interestingly.

While doing a search, I came across a similar issue which did not help.

However I decided to look into where that padding gets added in modal.js; it seems to happen in the _adjustDialog method which uses the _checkScrollbar method - this line specifically - to know whether the body is overflowing. It uses window.innerWidth to do that which, when I checked in my console, was giving a different value than expected (again, only on Windows).

After some research, I found this post which explained why that value could be wrong, and what to use instead: window.visualViewport.width. In our case, it would be Math.round(window.visualViewport.width) since we're also rounding the other value. I've tested that locally and it seems to be working for our scenario, but I'm not sure if it would break other things.

Assignee
Assign to
Time tracking