#10103 closed bug (fixed)
Dialog: Focus management should honor isDefaultPrevented
Reported by: | benshu | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.11.0 |
Component: | ui.dialog | Version: | 1.10.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Scenario
- The last tabbable element within a dialog has the focus.
- The user presses the tab key.
Behavior:
- The dialog registers the
keydown
event of the tab key. - The dialog moves the focus to the first tabbable element of the dialog.
Currently there is no way to prevent the described bahavior. If an independent listener tries to move the focus somewhere else, it is "overriden" by jQuery UI dialog. Because the dialog widget moves the focus with a delay of 1ms there is no reasonable workaround.
I contend that isDefaultPrevented() should be checked and that the focus should only be moved if it returns false.
FYI, the fix for #9646 is broken. Shift-tabbing from the first to the last element no longer works. The focus will remain on the first element.
Change History (6)
comment:1 Changed 9 years ago by
Status: | new → open |
---|
comment:2 Changed 9 years ago by
Summary: | modal dialog focus magic does not respect isDefaultPrevented → Dialog: Focus management should honor isDefaultPrevented |
---|
comment:3 Changed 9 years ago by
PR for the shift-tab issue: https://github.com/jquery/jquery-ui/pull/1264
comment:4 Changed 9 years ago by
Dialog: Fix shift-tab handling, focus the correct element
Copy-paste error introduced in df6110c0d424ff3306fdd5576011f2dcf4d242d0
Updates the tabbing test to be more specific about which element should have focus, instead of only checking if focus is within the dialog.
Ref #9646 Ref #10103 Closes gh-1264
Changeset: a0b84767a76098cdcc6375dfe28a7fee866bd395
comment:5 Changed 9 years ago by
Milestone: | none → 1.11.0 |
---|---|
Resolution: | → fixed |
Status: | open → closed |
comment:6 Changed 9 years ago by
Dialog: Honor preventDefault when managing focus
If event.isDefaultPrevented() is true, the focus management is completely skipped, assuming the user manages focus manually.
Fixes #10103 Closes gh-1265
Changeset: 226cc3e9e57c7591ff6a2ee02ffed52ac97786a9
I agree with this proposal. The shift-tab behavior is a simple fix as well, looks like it was a copy/paste error.