Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus on confirm in ConfirmationModal #945

Open
huwshimi opened this issue Jul 17, 2023 · 1 comment
Open

Focus on confirm in ConfirmationModal #945

huwshimi opened this issue Jul 17, 2023 · 1 comment

Comments

@huwshimi
Copy link
Collaborator

It would be nice if there was a way to set the focus on the confirm button when opening the modal so that users can press enter to confirm.

This should probably only happen if the confirm is positive (maybe it should focus on cancel if the action is negative). Here's how we do something similar in Juju Dashboard (though it only happens for "neutral" actions): https://github.com/canonical/juju-dashboard/blob/main/src/components/ConfirmationModal/ConfirmationModal.tsx#L23.

@bartaz
Copy link
Contributor

bartaz commented Nov 28, 2023

As discussed in the PR from accessibility point of view if the action is destructible (or at least hard to revert) modal should not focus on the action button, but rather cancel/close (which happens right now I believe).

Confirmation modal by definition is meant to be used to confirm actions that may have irreversible consequences.

If action is neutral, or easy to undo, why have confirmation modal at all? Can't it be triggered immediately (instead of opening the modal)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants