Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • !16152
An error occurred while fetching the assigned milestone of the selected merge_request.

Tooltip/popover: Fix auto placement to use viewport

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jarthod/tooltip-placement-viewport-fix into master 10 years ago
  • Overview 0
  • Commits 3
  • Pipelines 0
  • Changes 2

Created by: jarthod

Currently, auto placement is using the container dimensions (if provided) or the element's parent to determine where to open the tooltip:

var $container   = this.options.container ? $(this.options.container) : this.$element.parent()
var containerDim = this.getPosition($container)

This is quite broken in fact, because the parent element could be just a small div outside the element for example, leading in a totally random placement (placing the tooltip on top even if there's no room). And the container can also be outside of the viewport.

This fix simply uses the viewport instead, that's the purpose of the viewport actually, to position the tooltip. So the auto placement should use it to find where there's more room. By default this is body, which is good.

Compare
  • master (base)

and
  • latest version
    5921724d
    3 commits, 2 years ago

0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: github/fork/jarthod/tooltip-placement-viewport-fix

Menu

Explore Projects Groups Snippets