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

Disable issue/PR comment button given empty input #31463

Merged
merged 4 commits into from
Jun 23, 2024

Conversation

kemzeb
Copy link
Contributor

@kemzeb kemzeb commented Jun 22, 2024

Given an empty issue/PR comment, the comment history would not be updated if the user were to submit it. Therefore, it would make since to just disable the comment button when the text editor is empty.

This is inline with what GitHub does when given empty text editor input.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 22, 2024
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 22, 2024
@github-actions github-actions bot added modifies/templates This PR modifies the template files modifies/js labels Jun 22, 2024
@kemzeb
Copy link
Contributor Author

kemzeb commented Jun 22, 2024

I manually tested both issue/PR comments and they appear to work fine.

Before:

Screenshot 2024-06-22 at 12 03 26 PM

After:

Screenshot 2024-06-22 at 11 58 44 AM

@lafriks
Copy link
Member

lafriks commented Jun 22, 2024

Usually disabling buttons is not good UX practice as users cannot know why it's disabled. It's better to disallow submitting form with error notification about what is missing/invalid to submit form

@kemzeb
Copy link
Contributor Author

kemzeb commented Jun 22, 2024

Usually disabling buttons is not good UX practice as users cannot know why it's disabled. It's better to disallow submitting form with error notification about what is missing/invalid to submit form

Thanks for the review! As I explained in the desc I followed how GitHub handles this case (though I'm not sure if they inform the user about why it's disabled and I'm unable to check ATM).

With that said, I do agree with you and will look into your approach when I get the time.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jun 23, 2024

Usually disabling buttons is not good UX practice as users cannot know why it's disabled. It's better to disallow submitting form with error notification about what is missing/invalid to submit form

I do not think it is a must for this case. Everyone should know that empty content is not allowed to be submitted if the button is disabled.

And even more, it is quite hacky to add tooltip for a disabled element. So I prefer to go with this one, no more tooltip.

Copy link
Member

@delvh delvh left a comment

Choose a reason for hiding this comment

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

@wxiaoguang's approach sounds good

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 23, 2024
@lafriks
Copy link
Member

lafriks commented Jun 23, 2024

Usually disabling buttons is not good UX practice as users cannot know why it's disabled. It's better to disallow submitting form with error notification about what is missing/invalid to submit form

I do not think it is a must for this case. Everyone should know that empty content is not allowed to be submitted if the button is disabled.

And even more, it is quite hacky to add tooltip for a disabled element. So I prefer to go with this one, no more tooltip.

I'm not suggesting to add tooltip to disabled button but to not disable button and when clicked inform user that comment content is required

@wxiaoguang
Copy link
Contributor

I'm not suggesting to add tooltip to disabled button but to not disable button and when clicked inform user that comment content is required

I still prefer the current "disabled button" solution. The reason is:

  • It has a intuitive UI feedback. But by using "informing after clicking", it actually misleads the users that "oh the form can be submitted" and they could only get the feedback at the second step (after the click).
  • Injecting translation strings for a prompt message is still hacky in this case.
  • At least, the "disabled button" is consistent with GitHub's form.

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 23, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 23, 2024
@wxiaoguang wxiaoguang enabled auto-merge (squash) June 23, 2024 18:13
@wxiaoguang wxiaoguang merged commit 0c4ff01 into go-gitea:main Jun 23, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Jun 23, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 24, 2024
* giteaofficial/main:
  Disable issue/PR comment button given empty input (go-gitea#31463)
  Simplify 404/500 page (go-gitea#31409)
  Fix web notification icon not updated once you read all notifications (go-gitea#31447)
  Switch to "Write" tab when edit comment again (go-gitea#31445)
  Add simple JS init performance trace (go-gitea#31459)
@kemzeb kemzeb deleted the frontend-cond-disable-comment-button branch June 24, 2024 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/js modifies/templates This PR modifies the template files size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants