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
  • #16050
Closed
Open
Issue created Mar 12, 2015 by Administrator@rootContributor

IE scrolls top of iframe into view when modal within the iframe is shown

Created by: danschumann

Hello,

I have an iframe that is like 3000+ pixels in height. The top page scrolls, as the iframe will be whatever size it needs to be, so that it won't have a scrollbar.

There is a problem in IE, caused by this line:

      transition ?
        that.$element.find('.modal-dialog') // wait for modal to slide in
          .one('bsTransitionEnd', function () {
            that.$element.trigger('focus').trigger(e) // this line causes the problem!!!
            that.$element.trigger(e) // this fixes the problem!!!
          })
          .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
        that.$element.trigger('focus').trigger(e)

At approximately line 998 in 3.3.2

As you can see, removing trigger('focus') fixes it.

The problem in detail is: the top frame's scrollTop becomes the iframes offset().top.

This can be very unwanted. The user may be 2000 pixels into the iframe content, looking at something at the bottom, and when they open a modal, they are way at the top of the page again ( top of the iframe at least ).

Here is a hack I am using to fix:

    $modal.on('show.bs.modal', function(){
      // IE Fix:  bootstrap does a focus, which screws up the iframe by scrolling the parent window
      setTimeout(function(){
        $modal.find('.modal-dialog').off('bsTransitionEnd');
      }, 350);
    });
Assignee
Assign to
Time tracking