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.