-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix(web): Prevent DELETE key from clearing DateInput in modal #8846
Conversation
This might be out of scope for the current PR, but I'm wondering if this event propagation fix should be pulled into the |
Yeah I think you're right. Before we solve the same issue in a dozen places we should fix the actual issue at the root. |
@danieldietzler I fixed the keyboard issue that occurs in modals by adding stop propagation to the full-screen-modal component. What do you think? |
You don't want to essentially disable all events. Something like escape should still work there. #8846 (comment) applies here as well. |
@@ -45,9 +45,13 @@ | |||
|
|||
<FocusTrap> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the FocusTrap
will have to be moved, to make sure that it's still receiving the keyboard events needed to manage focus within the modal. Making it a direct child of the section
could be a fix for this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ben-basten Thank you, and I'll give it a try!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just changed this to just ignore events that originate from an input type that includes date and that seemed to fix the issue without needing to make any other changes.
This fixes the issue for keyboard shortcuts while focus is in the input. It doesn't address the issue for shortcuts triggering events while the modal is open and the focus is not in an input field. I think that is fine for now and can be left for a follow-up PR. |
This commit modifies the keydown event handler to stop the propagation of non-navigation key events in the change date modal.
So the DELETE key prevented the error of erasing the selected pictures.