Skip to content

Display confirmation popup whenever trying to submit a issue/comment in GitHub that's too short, and maybe every time #3911

Closed

Description

@darkred

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.


I have already posted this suggestion in isaacs/github#842 and contacted [email protected] years ago.

Activity

  1. 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
  2. fregante commented on Jan 24, 2021

    @fregante
    Member

    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.

  3. sindresorhus commented on Jan 24, 2021

    @sindresorhus
    Member

    @fregante Can we not block the submit event, and if the user responds yes, just synthesize it again?

  4. fregante commented on Jan 25, 2021

    @fregante
    Member

    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()

  5. darkred commented on Jan 27, 2021

    @darkred
    ContributorAuthor

    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.
  6. fregante commented on Jan 29, 2021

    @fregante
    Member

    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
  7. added
    small
    and removed on Mar 1, 2021
  8. fregante commented on Mar 1, 2021

    @fregante
    Member

    I'm thinking something like:

    function handleComment() {
    	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
    	}
    }
    
    function handleNewConversation() {
    	if ((body.length < 3 || title.length < 3) && !confirm('body too short, sure?')) {
    		event.preventDefault()
    	}
    }
    
    // pageDetect.hasComments
    delegate(…,'submit', handleComment)
    
    // pageDetect.isNewIssue / isNewPR
    delegate(…,'submit', handleNewConversation)
  9. darkred commented on Mar 16, 2021

    @darkred
    Author
  10. darkred commented on Mar 17, 2021

    @darkred
    Author
  11. fregante commented on Mar 17, 2021

    @fregante
  12. darkred commented on Mar 17, 2021

    @darkred
    Author
  13. fregante commented on Mar 28, 2021

    @fregante
    Member

    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. 🤷‍♂️

  14. darkred commented on Mar 28, 2021

    @darkred
    ContributorAuthor

    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

  15. fregante commented on Mar 28, 2021

    @fregante
    Member

    Again, shortness has nothing to do with the issue since the problem is “fat-fingering enter before you’re done”, which can happen at any length.

    Adding a confirmation regardless of length will just be annoying.

  16. darkred commented on Mar 28, 2021

    @darkred
    ContributorAuthor

    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:

    1. 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)

    2. 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' .

  17. fregante commented on Apr 16, 2021

    @fregante
    Member

    Moved to updated issue

  18. darkred commented on Apr 16, 2021

    @darkred
    ContributorAuthor

    @fregante Thanks for opening the updated issue.


    I just wanted to clarify, regarding my other suggested feature :

    1. 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.

  19. fregante commented on Apr 17, 2021

    @fregante
    Member

    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

  20. darkred commented on Apr 17, 2021

    @darkred
    ContributorAuthor

    Ok, thank you for replying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedenhancementsmall

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions