ButtonComponent: routerLink accessible even when button is disabled #15946
Labels
LTS-PORTABLE
Issue's fix will be ported to supported LTS versions
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
With a p-button component, if the button is disabled, and has a [routerLink], the routerLink is still accessible, meaning the button, even though appearing to be disabled, is still clickable and will route to the routerLink as intended (but without the actual functionality of the button click happening.
Sample Code:
<p-button label="Next Step" icon="fa-solid fa-chevron-right" iconPos="right" [routerLink]="next" [disabled]="!isFormValid() || !!uniqueNameErrMsg" />
In this example, if the form is invalid, the button, appearing disabled, can be clicked and will then go to the 'next' route.
This error was not happening in PrimeNG 17.17, but IS happening in 17.8.2
Environment
Mac OS Sonoma 14.5
VS Code 1.90.2
Chrome 126.0.6478.127
Reproducer
No response
Angular version
17.3.11
PrimeNG version
17.18.2
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
20.15.0
Browser(s)
No response
Steps to reproduce the behavior
Create a p-button Component
Make it disabled
apply a routerLink
Click on the button
It routes
Expected behavior
Clicking on the button should do nothing. This was the behavior in 17.17.0 of PrimeNG
The text was updated successfully, but these errors were encountered: