Skip to content

Bug: onClick should not be triggered on disabled links #8827

@lixiaoyan

Description

@lixiaoyan

Provide a general summary of the issue here

<Link
  isDisabled
  onClick={() => console.log('Button onClick')} // triggered
  onPress={() => console.log('Button onPress')} // not triggered
>
  Button
</Link>

🤔 Expected Behavior?

onClick should not be triggered.

😯 Current Behavior

onClick is triggered on the disabled link.

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

https://stackblitz.com/edit/rac-link-isdisabled-onclick-bug?file=src%2Findex.tsx

Version

1.12.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions