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

Dialog behaviour fixes #240

Merged
merged 1 commit into from
Feb 22, 2024
Merged

Dialog behaviour fixes #240

merged 1 commit into from
Feb 22, 2024

Conversation

microbit-robert
Copy link

@microbit-robert microbit-robert commented Feb 22, 2024

Only fire escape listener to close dialog while dialog is open. Stop calling open functions on app load.

See https://microbit-global.monday.com/boards/1356069004/views/10076885/pulses/1404321523

Only fire escape listener to close dialog while dialog is open.
Stop calling open functions on app load.
Copy link

Preview build will be at
https://review-ml.microbit.org/dialog-init/thenextgen/

Copy link

@microbit-grace microbit-grace 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

Comment on lines 57 to 61
const keyListener = (event: KeyboardEvent) => {
if (event.key === 'Escape') {
if (event.key === 'Escape' && isOpen) {
onCloseDialog();
}
};
Copy link

@microbit-grace microbit-grace Feb 22, 2024

Choose a reason for hiding this comment

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

It's so unexpected how the key listener is listening even when the dialog is not opened. I guess it's because the conditional that determines whether the dialog is being rendered is in this component itself so regardless of the state of the dialog this script runs? Yikes, didn't think of that before

@microbit-robert microbit-robert merged commit 17c9ea8 into main Feb 22, 2024
2 checks passed
@microbit-robert microbit-robert deleted the dialog-init branch February 22, 2024 14:37
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.

None yet

2 participants