radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
14.95k stars 728 forks source link

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

Open chonlatit-tpit opened 3 months ago

chonlatit-tpit commented 3 months ago

Bug report

Current Behavior

Expected behavior

Reproducible example

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 commented 3 months ago

Hi, anyone here ?