Skip to content

feat(hotkeys): Attach event listener to real DOM#521

Merged
mergify[bot] merged 1 commit intobox:masterfrom
mingzexiao6:exit-mode
Jun 19, 2020
Merged

feat(hotkeys): Attach event listener to real DOM#521
mergify[bot] merged 1 commit intobox:masterfrom
mingzexiao6:exit-mode

Conversation

@mingzexiao6
Copy link
Contributor

No description provided.

@mingzexiao6 mingzexiao6 requested a review from a team as a code owner June 19, 2020 00:00
Pick<FormikProps<FormValues>, 'errors' | 'setFieldValue' | 'values'>;

// export for test purpose
export const handleKeyDown = (handleCancel: () => void) => (event: KeyboardEvent): void => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should avoid testing the internals of the component whenever possible. Can we mount this component and set up a keydown listener on its parent document to make sure it doesn't get hit?

event.nativeEvent.stopImmediatePropagation();

onCancel(getFormattedCommentText(editorState).text);
handleCancel();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice, this is a good change.

@mergify mergify bot merged commit d17325c into box:master Jun 19, 2020
@mingzexiao6 mingzexiao6 deleted the exit-mode branch August 12, 2020 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants