Problem/Motivation
When we close (close or submit inner form) a modal dialog, the last focused element is moved into view which may be completely random (sometimes the first element in the parent form or the last element edited for example). That's not intended and the focused element should really be the button that opened the modal, we don't want any scrolling when it closes as it only confuses end users and they always have to scroll back.
Steps to reproduce
Open a course add/edit form, set focus on any field, open a modal (lesson parameters for example), close the modal. Observe the window jumps to the last focused field even if it was completely out of the viewport.
Proposed resolution
Focus on the trigger button before opening the modal.
Remaining tasks
This is really a core issue, when a modal dialog is opened, its opener is set to the last focused element instead of the actual opener. Find / create a core issue that addresses that and track.
Issue fork lms-3579438
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
graber commentedComment #4
graber commentedComment #6
graber commented