Skip to content

Commit

Permalink
MDL-78324 theme_boost: Only shift focus if origin focus unchanged
Browse files Browse the repository at this point in the history
In the Moodle additions for the Bootstrap Dropdown we update the focus
after a 50ms delay. This is presumably because the targetted focus point
may not have shown yet and may be opened in a separate thread, though
sadly the original reasoning is not documented, and is not mentioned in
the original issues.

As a result of this delay, it was possible for the user to start to
interact and then have focus stolen from them. In reality this does not
happen often - 50ms is simply too short a time for a human to do so, but
it is plenty of time for Behat to do so and we have seen some random
fails as other parts of the UI become faster. When this happens,
keyboard focus tests are broken by this 50ms behaviour.

The fix here updates the shift focus function when closing the menu to
check whether the focus has changed from the previous location already
before setting the focus.
  • Loading branch information
andrewnicols committed Sep 9, 2023
1 parent 82761c5 commit 83296b2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion theme/boost/amd/build/aria.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 83296b2

Please sign in to comment.