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

TypeError : and the error messageCannot read properties of undefined (reading 'defaultPrevented') #2824

Open
chonlatit-tpit opened this issue Apr 9, 2024 · 1 comment

Comments

@chonlatit-tpit
Copy link

Bug report

Current Behavior

  • We occasionally encounter errors from the monitoring tool. For example, TypeError: 'Cannot read properties of undefined' (reading 'defaultPrevented').

Expected behavior

  • Should be handle incase of undefined value.

Reproducible example

  • Can't reproduce

Suggested solution

We should add more condition to check event is undefined or not.
from:
if (checkForDefaultPrevented === false || !((event as unknown) as Event).defaultPrevented) {
to:
if (checkForDefaultPrevented === false || !event || !((event as unknown) as Event).defaultPrevented) {

REF:
https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx#L9

Additional context

Screenshot 2567-04-09 at 09 57 40

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-dialog ^0.1.5
React n/a
Browser Android 13
Assistive tech
Node n/a 18.18.2
npm/yarn
Operating System Android 13
@chonlatit-tpit
Copy link
Author

Hi, anyone here ?

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

No branches or pull requests

1 participant