-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accessibility: Add focus lock for the infinite editor (#8522)
* Toggle the inert attribute when adding or removing the first/last editor * Add focus lock directive for the editor * Increase timeout period so infinite editors transclusions will also have time to finish * Make sure elements containing .ng-hide are not part of the possible focusable elements * Update comments * Conditionally add umb-focus-lock and inert attributes * Hook into the evenservice to reinitialize the onInit method if the last editor has not been closed when the lock is used in infinite mode * Don't try to add focus to something that does not exist * Minor code refactor placing some variables outside the init method * Refactoring code to make things a bit more clean * Remove the event listener when the directive is destroyed * Add mutationObserver to watch for attribute changes and then trigger the getFocusableElements method * Fetch focusable elements on domChange * Ensure that args exists before trying to read the properties * Refactor to use mutationobserver when overlays are closed passing the correct target and re-initialising the directive to activate the focus lock * Change ng-hide to ng-if so the focusable elements inside the hidden div are not being selected * Narrow attributes to look for down to the bare minimum of the umb-focus-lock * Refactor to using good ol' for loop (Fastest) * Disconnect the observer once the init function has been called - Massive performance improvement * Event handler cleanup * Refactor the code to re-initialize the init method on destroy in case infinite editors still exists in the DOM * Align codestyle * Add logic to deal with "lastKnowFocused" elements in infinite editing mode * Re-add attributes after merge with contrib branch * Correct spelling mistake * Move onInit into the $includeContentLoaded event and set the timeout to 0 * Make sure to add focus to elements with role="button" as well * Add comments and remove timeout / delay settings * Debouce domObserver * Wrap init function in safeApply * Add comments to help remember / understand what things are intended to be doing and add missing event param as well as getting rid of some unused code * Adding more comments * Move setting of first and last focusable elements into the setElement function * Remove todo * Move the setup of first and last focusable elements back to where they were... Co-authored-by: Joe Glombek <[email protected]>
- Loading branch information
Showing
4 changed files
with
218 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editors.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Umbraco.Web.UI.Client/src/views/components/tree/umb-tree.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters