Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Fix 7598: showModalDialogUsingTemplate doesn't blur current editor - #7677

Merged
njx merged 2 commits into
masterfrom
tom/issue-7598
Jun 3, 2014
Merged

Fix 7598: showModalDialogUsingTemplate doesn't blur current editor#7677
njx merged 2 commits into
masterfrom
tom/issue-7598

Conversation

@TomMalbran

Copy link
Copy Markdown
Contributor

Since every dialog has at least one button that is not disabled (to be able to close the dialog), this will set the focus on any other button when the primary one is disabled.

@marcelgerber

Copy link
Copy Markdown
Contributor

You can't even expect a dialog to have one button. Most have, but some not.

Comment thread src/widgets/Dialogs.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will select a button in the modal-body if there's one. I believe only buttons in the fooder should be focussed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Nice catch!

@TomMalbran

Copy link
Copy Markdown
Contributor Author

I just got some time to fix this. It will now try to focus the primary button, then any other button in the footer and finally the actual dialog, which should now actually work for every dialog.

Comment thread src/widgets/Dialogs.js

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We not try and set focus to the element with the lowest tabindex first?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how that will work. But maybe we can first focus any input.

@njx