palantir/blueprint

Enabled anchor buttons don't trigger the onClick callback if the button is immediately disabled after being clicked. Buttons do.

オープン

#5,245 opened on 2022/04/07

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)TypeScript (2,167 件のフォーク)batch import
P3Package: coreType: bughelp wanted

Repository metrics

Stars
 (20,263 個のスター)
PR merge metrics
 (平均マージ 43d 10h) (30d で 27 merged PRs)

説明

Environment

  • Package version(s):
  • Operating System:
  • Browser name and version:

Code Sandbox

I have a button that I only want to be enabled when a certain element has focus. When the user clicks the button, that element will no longer have focus so the button will no longer be enabled, but I want the initial click to go through and trigger the onClick callback. I am seeing this work with <Button /> but not <AnchorButton />. It'd be nice if when I clicked an enabled anchor button, the onClick callback went through even if I immediately disable the button. I can't just use a Button instead because I also want to show a tooltip on the disabled button which AnchorButtons are recommended for.

Bug report Package version(s): Browser and OS versions:

Expected behavior When I click an enabled button, the callback is run

Steps to reproduce

  1. Have an anchor button that is disabled when a given element doesn't have focus and has an onclick callback

  2. Click the button

  3. The callback isn't run

  4. Repeat the above with a normal Button

  5. The callback is run

Actual behavior

If I click a button while it's enabled and then immediately disabled it, the callback isn't run

Expected behavior

When I click an enabled button, the callback is run

Possible solution

コントリビューターガイド