mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: unconditionally focus modals (#13179)
Previously auto focus would only work on modals that include buttons or inputs. To avoid a situation where information modals such as keyboard shortcuts do not get focus, simply focus on the close button as a fallback.
This commit is contained in:
parent
34c5df2700
commit
489535e5c7
@ -141,6 +141,10 @@ export default Component.extend({
|
||||
focusTarget = this.element.querySelector(
|
||||
".modal-body input, .modal-body button, .modal-footer input, .modal-footer button"
|
||||
);
|
||||
|
||||
if (!focusTarget) {
|
||||
focusTarget = this.element.querySelector(".modal-header button");
|
||||
}
|
||||
}
|
||||
if (focusTarget) {
|
||||
afterTransition(() => focusTarget.focus());
|
||||
|
Loading…
Reference in New Issue
Block a user