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

FormTokenField: handle disabled prop on internal Button #57187

Merged
merged 3 commits into from
Dec 21, 2023

Conversation

chad1008
Copy link
Contributor

replaces #23713

What?

Pass the disabled prop to the Button component on selected tokesn

Why?

When FormTokenField is disabled, the buttons don't remove tokens because the click isn't handled. The buttons are still focusable though, which isn't ideal.

How?

prop forwarding

Testing Instructions

  1. Launch Storybook and test the Default FormTokenField story
  2. Select a couple of options
  3. In the Controls panel, set Disabled to true
  4. Confirm that the tokens you've added cannot be removed, and clicking on the x button doesn't apply focus.

@chad1008 chad1008 added the [Type] Bug An existing feature does not function as intended label Dec 18, 2023
@chad1008 chad1008 requested a review from a team December 18, 2023 21:54
@chad1008 chad1008 self-assigned this Dec 18, 2023
Copy link
Contributor

@andrewhayward andrewhayward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was initially going to say it feels weird to include the 'remove' buttons at all if the control is disabled, but actually that feels more like read-only behaviour. So 🚀 – works for me.

@chad1008
Copy link
Contributor Author

Thanks @andrewhayward!

@chad1008 chad1008 enabled auto-merge (squash) December 21, 2023 02:34
Copy link

Flaky tests detected in a9d29a8.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7283296905
📝 Reported issues:

@chad1008 chad1008 merged commit 891c4cf into trunk Dec 21, 2023
55 of 56 checks passed
@chad1008 chad1008 deleted the fix/form-token-field-disabled-button branch December 21, 2023 03:00
@github-actions github-actions bot added this to the Gutenberg 17.4 milestone Dec 21, 2023
@bph bph added the [Package] Components /packages/components label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants