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
  • #35391
Closed
Open
Issue created Nov 23, 2021 by Administrator@rootContributor2 of 2 checklist items completed2/2 checklist items

Restore focus to modal triggering element using { preventScroll: true }

Created by: smares

Prerequisites

  • I have searched for duplicate or closed feature requests
  • I have read the contributing guidelines

Proposal

If I understand correctly, Bootstrap restores the focus to the triggering element when a modal ist closed.

In some cases, closing a modal will scroll the page to the top. The focus management API (https://html.spec.whatwg.org/multipage/interaction.html#focus-management-apis) says that focus can be passed { preventScroll: true } on supported browsers. https://webplatform.news/issues/2019-04-19#preventing-scroll-into-view-when-calling-focus says that this is especially useful "when dynamically restoring focus after the user closes a modal dialog or reopens a tab panel".

Motivation and context

Closing modals should not scroll the page.

Assignee
Assign to
Time tracking