You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Display confirmation popup whenever trying to submit a issue/comment in GitHub that's too short, and maybe every time #3911
GitHub allows in the Issues and Discussions section of repos:
to submit a new issue with just 1 character as title and no body, and
to submit a comment with just 1 character .
Apart from that, personally, I sometimes accidentally press the submit keyboard shortcut before my issue/comment text is ready.
mainly because the build-in hotkey for submitting an issue/comment is Ctrl + Enter (I confuse it with Shift + Enter)
or just Enter if typing in the title textbox.
This is embarrassing, having the other members trying to reply to your half-made issue/comment while you still try to finish it...
Also, posting a comment of just a few characters instead of using a reaction is rarely useful.
So, my suggestion is to add a feature to RG to display a confirmation popup (or a subtle warning message, to press again Submit to confirm) in such edge cases,
and, maybe every time you try to submit a new issue/comment .
I believe that getting a confirmation serves as a reminder to make sure that you have it indeed ready before submitting.
Thank you
For reference I have this script: GitHub - Confirmations before submitting issues and comments
which displays a confirmation popup whenever trying to submit a new issue or comment via Ctrl+Enter or Enter,
but it's too simple (it doesn't even take into account the text length), in general it's way too far from perfect.
changed the title [-]Suggestion: display confirmation popup whenever trying to submit a issue/comment in GitHub that's too short, and maybe every time[/-][+]Display confirmation popup whenever trying to submit a issue/comment in GitHub that's too short, and maybe every time[/+]on Jan 24, 2021
We can’t block submissions because that would annoy people. We have some warnings like “pr from master” but they’re just warnings. If you press Enter it’s too late to display a warning without also blocking the submissions.
So you’re suggesting we ask for confirmation if the body is too short? Given that confirm() is synchronous we’d just need if !confirm(), then event.preventDefault()
Would it be possible, instead of using the confirm() synchronous modal,
to follow a more subtle approach: bubble popup ? (see how they look like here )
What I have in mind is:
RG to disable in advance all ways of submission (i.e. the Submit new issue and Comment buttons as well as Ctrl+Enter/Enter),
then RG to attach its own event listeners for these buttons and keypresses,
if the user clicks/presses them, to show a bubble popup on the textarea (or the button) with a warning message
And if user clicks e.g. Enter, RG to make the submission itself.
Indeed, either way it requires one more action from the user, however from a code perspective:
confirm() is easy, but we need to re-enable the form if the user clicks "Cancel" because GitHub breaks it on submit regardless of our confirmation.
what you're suggesting requires the same changes (since the first submission will be cancelled) + appending a message in the DOM (I'm thinking something like this rather than the tooltip) + making sure that the user sees the message (it might be out of the viewport)
So perhaps it's not worth it. It may look nicer but it's more troublesome:
confirm() will never stop working
but a DOM element needs to be attached to an existing element, and the selectors always change
functionhandleComment(){if(body.length<3&&!confirm('body too short, sure?')){event.preventDefault()event.stopImmediatePropagation()// I don't know if it's necessary to stop comments, they're sent via ajax}}functionhandleNewConversation(){if((body.length<3||title.length<3)&&!confirm('body too short, sure?')){event.preventDefault()}}// pageDetect.hasCommentsdelegate(…,'submit',handleComment)// pageDetect.isNewIssue / isNewPRdelegate(…,'submit',handleNewConversation)
This just happened to me because I fat-fingered the enter key; This feature would not have saved me because the title was long enough, but just not done.
The only way to fix it would be to disable the regular enter key and always use cmd+enter even in input[type=text] fields like commits titles, conversation titles, PR merge titles, … but this would likely annoy everyone. 🤷♂️
I'd say to disable Enter in input[type=text] fields only in Issue/PR titles:
from all cases where someone might submit a message by mistake (mistyping Enter), I think the Issues and PR lists are the most annoying to happen:
I have in mind the contributors in a repo who have chosen to get email notifications for every new Issue and PR.
Regarding confirm(), what if we followed a different approach?
My idea is to avoid the use of the admittedly obtrusive confirm(), in fact not display a dialog box at all,
and just modify the forms functionality so that their "Submit" buttons only become active when what you have typed is long enough? Till then to remain disabled/grayed-out.
And of course rename the feature to: disallow-short-comments
To summarize:
the issue I describe in the OP is two-fold :
that GitHub allows too short messages, which just 1 character,
that GitHub allows submitting via plain Enter in input[type=text] fields. This is not a problem per se, but it facilitates submitting half-made submissions.
Also, in my OP I suggested as an overall solution, to display confirmation popups confirm() .
Seeing your comments I agree that the above approach might be annoying for the users,
and that it doesn't solve the 'mistyping Enter' case.
That's why with my last comment, I suggested something different, a two-part feature, that would be as subtle to the user as possible:
disallow-short-comments:
Enable submitting based on length,
i.e. the Submit button to remain disabled until both title and body content have length more than a given value, e.g. 3. (no confirm(), no confirmation dialog at all)
disable-submit-via-enter-in-singleline-text-fields:
Disable submitting via Enter (regardless of length) in input[type=text] fields in only 2 places: New Issue and New PR pages:
i.e. when you have focus to the title field in new Issue/PR pages, to be able to submit only via Ctrl+Enter or clicking 'Submit' .
I just wanted to clarify, regarding my other suggested feature :
disallow-short-comments:
Enable submitting based on length,
i.e. the Submit button to remain disabled until both title and body content have length more than a given value, e.g. 3. (no confirm(), no confirmation dialog at all)
Don't you think this would be useful to have as well?
It would prevent submitting issues with just 1 character title and no body, and comments with just 1 character.
Submitting an issue with such a short title and no body, I doubt it could have anything to offer.
And, posting a comment of just a few characters instead of using a reaction is rarely if ever useful.
Activity
[-]Suggestion: display confirmation popup whenever trying to submit a issue/comment in GitHub that's too short, and maybe every time[/-][+]Display confirmation popup whenever trying to submit a issue/comment in GitHub that's too short, and maybe every time[/+]fregante commentedon Jan 24, 2021
We can’t block submissions because that would annoy people. We have some warnings like “pr from master” but they’re just warnings. If you press Enter it’s too late to display a warning without also blocking the submissions.
sindresorhus commentedon Jan 24, 2021
@fregante Can we not block the submit event, and if the user responds yes, just synthesize it again?
fregante commentedon Jan 25, 2021
So you’re suggesting we ask for confirmation if the body is too short? Given that
confirm()is synchronous we’d just needif !confirm(), then event.preventDefault()darkred commentedon Jan 27, 2021
Would it be possible, instead of using the
confirm()synchronous modal,to follow a more subtle approach: bubble popup ? (see how they look like here )
What I have in mind is:
fregante commentedon Jan 29, 2021
Indeed, either way it requires one more action from the user, however from a code perspective:
confirm()is easy, but we need to re-enable the form if the user clicks "Cancel" because GitHub breaks it on submit regardless of our confirmation.So perhaps it's not worth it. It may look nicer but it's more troublesome:
confirm()will never stop workingfregante commentedon Mar 1, 2021
I'm thinking something like:
darkred commentedon Mar 16, 2021
darkred commentedon Mar 17, 2021
fregante commentedon Mar 17, 2021
darkred commentedon Mar 17, 2021
fregante commentedon Mar 28, 2021
This just happened to me because I fat-fingered the enter key; This feature would not have saved me because the title was long enough, but just not done.
The only way to fix it would be to disable the regular enter key and always use cmd+enter even in
input[type=text]fields like commits titles, conversation titles, PR merge titles, … but this would likely annoy everyone. 🤷♂️darkred commentedon Mar 28, 2021
I'd say to disable Enter in
input[type=text]fields only in Issue/PR titles:from all cases where someone might submit a message by mistake (mistyping Enter), I think the Issues and PR lists are the most annoying to happen:
I have in mind the contributors in a repo who have chosen to get email notifications for every new Issue and PR.
Regarding
confirm(), what if we followed a different approach?My idea is to avoid the use of the admittedly obtrusive
confirm(), in fact not display a dialog box at all,and just modify the forms functionality so that their "Submit" buttons only become active when what you have typed is long enough? Till then to remain disabled/grayed-out.
And of course rename the feature to:
disallow-short-commentsfregante commentedon Mar 28, 2021
Again, shortness has nothing to do with the issue since the problem is “fat-fingering
enterbefore you’re done”, which can happen at any length.Adding a confirmation regardless of length will just be annoying.
darkred commentedon Mar 28, 2021
To summarize:
the issue I describe in the OP is two-fold :
input[type=text]fields.This is not a problem per se, but it facilitates submitting half-made submissions.
Also, in my OP I suggested as an overall solution, to display confirmation popups
confirm().Seeing your comments I agree that the above approach might be annoying for the users,
and that it doesn't solve the 'mistyping Enter' case.
That's why with my last comment, I suggested something different, a two-part feature, that would be as subtle to the user as possible:
disallow-short-comments:Enable submitting based on length,
i.e. the Submit button to remain disabled until both title and body content have length more than a given value, e.g. 3.
(no
confirm(), no confirmation dialog at all)disable-submit-via-enter-in-singleline-text-fields:Disable submitting via Enter (regardless of length) in
input[type=text]fields in only 2 places: New Issue and New PR pages:i.e. when you have focus to the title field in new Issue/PR pages, to be able to submit only via Ctrl+Enter or clicking 'Submit' .
fregante commentedon Apr 16, 2021
Moved to updated issue
darkred commentedon Apr 16, 2021
@fregante Thanks for opening the updated issue.
I just wanted to clarify, regarding my other suggested feature :
Don't you think this would be useful to have as well?
It would prevent submitting issues with just 1 character title and no body, and comments with just 1 character.
Submitting an issue with such a short title and no body, I doubt it could have anything to offer.
And, posting a comment of just a few characters instead of using a reaction is rarely if ever useful.
fregante commentedon Apr 17, 2021
We can’t block actions by the user. If they want to open a 1-emoji issue, let them. The other issue takes care of accidental presses
darkred commentedon Apr 17, 2021
Ok, thank you for replying.