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

ButtonComponent: routerLink accessible even when button is disabled #15946

Closed
TheTiGuR opened this issue Jul 2, 2024 · 0 comments · Fixed by #15989 · 4 remaining pull requests
Closed

ButtonComponent: routerLink accessible even when button is disabled #15946

TheTiGuR opened this issue Jul 2, 2024 · 0 comments · Fixed by #15989 · 4 remaining pull requests
Assignees
Labels
LTS-FIXED-15.4.23 LTS-FIXED-16.9.13 LTS-PORTABLE Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@TheTiGuR
Copy link

TheTiGuR commented Jul 2, 2024

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

@TheTiGuR TheTiGuR added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 2, 2024
@mehmetcetin01140 mehmetcetin01140 self-assigned this Jul 9, 2024
@mehmetcetin01140 mehmetcetin01140 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 Jul 9, 2024
@mehmetcetin01140 mehmetcetin01140 added this to the 17.18.4 milestone Jul 9, 2024
cetincakiroglu added a commit that referenced this issue Jul 11, 2024
Fixed #15946 - ButtonComponent: routerLink accessible even when butto…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment