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

Auto focus on cancel on confirmation modal #7275

Merged
merged 2 commits into from
Jan 4, 2022
Merged

Conversation

gtsiolis
Copy link
Contributor

Description

This will add auto focus on the Cancel button for the confirmation modal to avoid leading users to accidentally performing destructive actions like removing a project or deleting a workspace.

How to test

  1. Add a new project or open a new workspace
  2. Try removing a project or deleting a workspace
BEFORE AFTER
Screenshot 2021-12-17 at 12 49 16 AM (2) Screenshot 2021-12-17 at 12 49 21 AM (2)
Screenshot 2021-12-17 at 12 49 27 AM (2) Screenshot 2021-12-17 at 12 50 09 AM (2)

Release Notes

Auto focus on cance on confirmation modal

@roboquat roboquat added release-note team: webapp Issue belongs to the WebApp team size/XS labels Dec 16, 2021
Copy link
Contributor Author

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

@jankeromnes could you take a look at this since you added the project removal action in #6185? Maybe I'm missing something but deleting a workspace works as expecrted. Also, what do you think of this change? 🙂

@@ -45,7 +45,7 @@ export default function ConfirmationModal(props: {
}

const buttons = [
<button className="secondary" onClick={props.onClose}>Cancel</button>,
<button className="secondary" onClick={props.onClose} autoFocus>Cancel</button>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

issue: This still removes the project when pressing enter. 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved with dcf0b6d. See #7275 (comment).

@gtsiolis
Copy link
Contributor Author

gtsiolis commented Dec 17, 2021

/werft run

👍 started the job as gitpod-build-gt-autofocus-on-cancel.1

@JanKoehnlein
Copy link
Contributor

@gtsiolis I've added focus inspection to the onEnter listener, and it works now as specified. I think we need more sophisticated focus handling in general, e.g. vie the tab key, so I am a bit undecided whether we should start with that here.

@gtsiolis
Copy link
Contributor Author

gtsiolis commented Dec 29, 2021

Thanks @JanKoehnlein! UX works as expected. ✔️

I think we need more sophisticated focus handling in general

Yes, we do! Currently only buttons have proper focus states and some elements are missing focus state like the checkboxes, etc

Taking a bias-for-action and merging this for now as it looks like a good MVC (minimum viable change) iteration.

Looping in @jankeromnes in case there's anything else we could fix around this change in a follow up PR. 🏓

@gtsiolis gtsiolis added the lgtm label Dec 29, 2021
@gtsiolis
Copy link
Contributor Author

gtsiolis commented Dec 29, 2021

Ah, we still need a PR approval here. ⏱️

@JanKoehnlein
Copy link
Contributor

/approve

@JanKoehnlein
Copy link
Contributor

/approve no-issue

@roboquat
Copy link
Contributor

roboquat commented Jan 4, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JanKoehnlein

Associated issue requirement bypassed by: JanKoehnlein

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat merged commit ee68fdd into main Jan 4, 2022
@roboquat roboquat deleted the gt/autofocus-on-cancel branch January 4, 2022 16:00
@gtsiolis
Copy link
Contributor Author

gtsiolis commented Jan 4, 2022

Je vous remercie, @JanKoehnlein! 🏀

@JanKoehnlein
Copy link
Contributor

JanKoehnlein commented Jan 4, 2022

Je t'en pris, @gtsiolis! 🏀

@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved component: dashboard deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note size/XS team: webapp Issue belongs to the WebApp team user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants