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

Component: AccordionTab.toggle(null) throws TypeError #13872

Closed
lwestfall opened this issue Oct 12, 2023 · 0 comments · Fixed by #13873
Closed

Component: AccordionTab.toggle(null) throws TypeError #13872

lwestfall opened this issue Oct 12, 2023 · 0 comments · Fixed by #13873
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@lwestfall
Copy link
Contributor

lwestfall commented Oct 12, 2023

Describe the bug

event is an optional parameter in .toggle(). When omitted or passed null, it throws an error due to the following line lacking null safety:

event.preventDefault();

Throws: TypeError: Cannot read properties of undefined (reading 'preventDefault')

Environment

N/A

Reproducer

No response

Angular version

^16.2.0

PrimeNG version

~16.4.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.12.0

Browser(s)

No response

Steps to reproduce the behavior

  1. Call accordionTab.toggle() where accordionTab is a child component

Expected behavior

No error is thrown after adding null safety

@lwestfall lwestfall added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 12, 2023
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 13, 2023
@cetincakiroglu cetincakiroglu added this to the 16.5.1 milestone Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants