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

Tooltip: Crashes when position prop is undefined #6648

Closed
grddavies opened this issue May 22, 2024 · 1 comment · Fixed by #6651, leoo1992/GeradorQRCode#40 or mtech-31-quemistry/quemistry_client_web#3
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@grddavies
Copy link

Describe the bug

Instantiating a Tooltip with position={undefined} results in the following error:

Uncaught TypeError: Cannot read properties of undefined (reading 'my')

Despite being permitted by the TooltipOptions type declaration:
position?: 'top' | 'bottom' | 'left' | 'right' | 'mouse' | undefined;

Reproducer

https://stackblitz.com/edit/vitejs-vite-phqpg8?file=src%2FApp.tsx

PrimeReact version

10.6.5

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Mouse over the 'i' icon

Expected behavior

No crash.
Position set to default value 'right'

@grddavies grddavies added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 22, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 22, 2024
melloware added a commit to melloware/primereact that referenced this issue May 22, 2024
@melloware melloware self-assigned this May 22, 2024
@melloware melloware added this to the 10.7.0 milestone May 22, 2024
@melloware
Copy link
Member

Thanks PR submitted. the TS Doc say right is the default if undefined so i fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment