Fixes #69 Incorrect focus trap in modal dialog #103
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I modified this to keep the focus within the modal dialog as
the user tabs and shift-tabs through the items. This
was done by adding onkeydown handlers to the first and
last focusable /tab-able items in the dialog. When last
item has focus a tab press is captured and focus is set to the first
focusable item. When the first item has focus and a shift-tab is
captured, focus is sent to the last focusable item in the dialog.
Since focus never leaves the dialog, the default handler set in the
enforceFocus function of original modal plugin code is never invoked.
Tested with VoiceOver in Safari,
JAWS 17 and NVDA in Firefox on Windows 10
The convention seems to be to also check in the built files so I included them in the pull request. What about the _site directory? src/js/modal.js was already out of sync when I made my changes so I didn't check in an updated version.