Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@paaatrrrick
Copy link
Contributor

This is a PR for the issue: #1435

Issue Description: "When writing a new root comment or replying to an existing one, hitting the 'cancel' button unfocuses the text box but doesn't actually delete the in-progress comment and hide the text field."

Example of the Issue:

CommentCancelBug

Desired Response:

CommentCancelFix

Note: The functionality for pressing the 'cancel' button when replying to an existing comment remains unchanged. I chose to do this because if the new comment is hidden, the UI leaves it unclear how to leave a reply.

doCreate()
}),
button(['cancel'], {}, ['Cancel']).mousedown(() => controls.classList.add("hide"))
button(['cancel'], {}, ['Cancel']).mousedown(() => {hide ? hide() : controls.classList.add("hide")})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the NewComment 'cancel' button is pressed, if a 'hide' function is passed in, it is called to remove the whole component. Otherwise, the controls (the 'cancel' and 'submit' buttons) will be hidden.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! If we wanted, we could maybe also clear the text in the comment text area specifically for replies (the 2nd branch of that ternary statement), so it both hides the controls and leaves a blank text box. Just an offhand thought, feel free to take or leave it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea @mjren23! I just added it.

this.clicked = true;

const newComment = new NewComment(commentsState, () => range)
const newComment = new NewComment(commentsState, () => range, this.hide.bind(this))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To remove a NewComment previously, a user had to click outside of the selected area of the cell. On line 131, this click called the 'CommentButton' hide function on line 397.
I chose to call this same hide function when a user presses 'cancel' on a root NewComment.

doCreate()
}),
button(['cancel'], {}, ['Cancel']).mousedown(() => controls.classList.add("hide"))
button(['cancel'], {}, ['Cancel']).mousedown(() => {hide ? hide() : controls.classList.add("hide")})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! If we wanted, we could maybe also clear the text in the comment text area specifically for replies (the 2nd branch of that ternary statement), so it both hides the controls and leaves a blank text box. Just an offhand thought, feel free to take or leave it!

Copy link
Collaborator

@jonathanindig jonathanindig left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

@jonathanindig jonathanindig merged commit 2d6f1ba into polynote:master Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.