8000 fix: only allow submitting form if changes have been made by DanielleMaywood · Pull Request #14602 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

fix: only allow submitting form if changes have been made #14602

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

Conversation

DanielleMaywood
Copy link
Contributor

Fixes #14320

This disables the submit button if the form is not dirty, meaning the button can only be enabled if the form has had changes to it.

Screen.Recording.2024-09-09.at.09.38.04.mp4

@DanielleMaywood DanielleMaywood changed the title fix: only allow submitting form if dirty fix: only allow submitting form if changes have been made Sep 9, 2024
@DanielleMaywood DanielleMaywood marked this pull request as ready for review September 9, 2024 09:13
@dannykopping
Copy link
Contributor
dannykopping commented Sep 9, 2024

I'm not sure this solution will be very clear for users.

IMHO we'd probably want to change the behaviour of the button, not whether it's enabled or not:

  • no changes: noop behaviour, and indicate as such in the button text
  • with changes: change the color/text to indicate that a restart will happen with the new settings

WDYT @stirby?

@DanielleMaywood
Copy link
Contributor Author
  • no changes: noop behaviour, and indicate as such in the button text

I'm not sure I understand the reasoning for having a 'submit' button that we know (and communicate) to do nothing.

  • with changes: change the color/text to indicate that a restart will happen with the new settings

I think this might be overlapping with a separate issue #14319

@dannykopping
Copy link
Contributor

I'm not sure I understand the reasoning for having a 'submit' button that we know (and communicate) to do nothing.

Agreed. I'm motivating for a change to the naming of the button as well.

@DanielleMaywood
Copy link
Contributor Author

Agreed. I'm motivating for a change to the naming of the button as well.

Okay. And just for confirmation: You'd want the button to be submittable but act as a no-op?

@dannykopping
Copy link
Contributor

Yup. I'm no UX designer but that would at least be the most obvious to the user IMHO.

If I saw a button that said "Submit without changes", I'd know exactly what that meant.

If I made changes and the button turned orange and said "Restart with changes" with a little notice that said that the workspace would be restarted and any non-persistent data would be destroyed, there would similarly be no possibility for confusion, I feel.

@DanielleMaywood
Copy link
Contributor Author
DanielleMaywood commented Sep 9, 2024

If I saw a button that said "Submit without changes", I'd know exactly what that meant.

I can only speak for myself but I'd expect the behaviour of this to do something. In this scenario, would the "Cancel" button and the "Submit without change" button have any difference in behaviour?

If I made changes and the button turned orange and said "Restart with changes" with a little notice that said that the workspace would be restarted and any non-persistent data would be destroyed, there would similarly be no possibility for confusion, I feel.

I think this is more related to the other issue #14319 (I agree it should be more obvious but I think that's out of scope for this issue)

@DanielleMaywood
Copy link
Contributor Author

@BrunoQuaresma Do you have any opinions on what the design should be here?

@BrunoQuaresma
Copy link
Collaborator

@DanielleMaywood disabling the button when there are no changes is a broad use pattern and I also agree we could rename the button to make what will happen clearer. Maybe we could change to "Submit and restart" or "Apply and restart"?

@@ -73,3 +73,58 @@ test("Submit the workspace settings page successfully", async () => {
});
});
});

test("Submit button is only enabled when changes are made", async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think for now, having a test for this in Jest is ok, but in the future, you can try to use storybook and interaction tests :)

Copy link
Collaborator
@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

I will leave up to you to decide to change or not the button label

@DanielleMaywood DanielleMaywood force-pushed the dm-disable-submit-button-for-workspace-params-when-no-changes branch from 0d4b625 to 230de7f Compare September 13, 2024 14:40
@DanielleMaywood DanielleMaywood merged commit 9006b21 into main Sep 13, 2024
25 of 27 checks passed
@DanielleMaywood DanielleMaywood deleted the dm-disable-submit-button-for-workspace-params-when-no-changes branch September 13, 2024 15:19
@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable submit button for editing workspace parameters when no changes are made
3 participants
0