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
  • Merge requests
  • !33603

Fix `Manipulator.offset()`

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/alpadev/fix-manipulator-offset into main Apr 10, 2021
  • Overview 16
  • Commits 8
  • Pipelines 0
  • Changes 2

Created by: alpadev

fixes https://github.com/twbs/bootstrap/issues/32496, closes https://github.com/twbs/bootstrap/pull/32341

Background

Manipulator.offset() is using getBoundingClientRect() that returns top/left values relative to the viewport. The current implementation uses document.body.scrollTop and document.body.scrollLeft to get the scroll position of the viewport. (Both returning 0 in current Chrome and FF)

This used to work with older browsers but since then got changed to document.documentElement.scrollTop and document.documentElement.scrollLeft. The currently proposed way to get those values (according to MDN) is to use window.pageYOffset and window.pageXOffset.

TBD

  • Should we also add fallbacks for window.pageYOffset and window.pageXOffset mentioned on the MDN page?

  • Not sure about the test cases. Maybe someone got a better idea how to implement them.

Preview: https://deploy-preview-33603--twbs-bootstrap.netlify.app/docs/5.0/components/scrollspy/

Example of #32496 (closed) using the fix: https://codepen.io/-alpa-/pen/MWpVooG

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/alpadev/fix-manipulator-offset