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

isDisabled not working in Breadcrumbs.Item alongside Breadcrums.Link #4776

Closed
4 tasks done
regularpersonn opened this issue Nov 21, 2023 · 6 comments
Closed
4 tasks done
Labels
feature-request Request a new feature Primitive An issue or a feature-request for one or more UI Primitive

Comments

@regularpersonn
Copy link

regularpersonn commented Nov 21, 2023

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

React

Which UI component?

Primitive components

How is your app built?

Create React

What browsers are you seeing the problem on?

Chrome, Safari

Which region are you seeing the problem in?

No response

Please describe your bug.

isDisabled flag is not being respected despite confirming that the framework is rendering <a disabled... component in HTML.

What's the expected behaviour?

Breadcrumb item should be disabled when isDisabled is true for either Item or Link

Help us reproduce the bug!

Can be reproduced by using the provided code snippet (note I am even hard coding true and it doesn't disable the link).

Code Snippet

       <Breadcrumbs.Container>
          <Breadcrumbs.Item >
            <Breadcrumbs.Separator />
            <Breadcrumbs.Link onClick={() => setStep(1)} isCurrent={step === 1}>Select Blueprint</Breadcrumbs.Link>
            <Breadcrumbs.Separator />
          </Breadcrumbs.Item>
          <Breadcrumbs.Item isDisabled={true}>
            <Breadcrumbs.Link onClick={() => setStep(2)} isCurrent={step === 2} isDisabled={true}>Select 2</Breadcrumbs.Link>
            <Breadcrumbs.Separator />
          </Breadcrumbs.Item>
        </Breadcrumbs.Container> 

Console log output

No response

Additional information and screenshots

image
@github-actions github-actions bot added the pending-triage Issue is pending triage label Nov 21, 2023
@esauerbo esauerbo added being-investigated Primitive An issue or a feature-request for one or more UI Primitive and removed pending-triage Issue is pending triage labels Nov 21, 2023
@esauerbo
Copy link
Contributor

Hi @regularpersonn thanks for raising this. Could you clarify exactly what the desired behavior is, e.g. are you thinking the onClick handlers shouldn't run if disabled?

@regularpersonn
Copy link
Author

regularpersonn commented Nov 21, 2023

Yeah. My use case is I want the breadcrumbs to only function when the previous one has met the correct condition, as each one allows a selection that builds upon the previous one.

@esauerbo esauerbo added bug Something isn't working and removed pending-response labels Nov 21, 2023
@esauerbo
Copy link
Contributor

We're working on a fix for this, and I'll update you when we get that released. In the meantime you can add disabled styling to the breadcrumbs item using css. If you do something like this you can add isDisabled to just the Breadcrumbs.Item and it will prevent onclick events from firing.

.amplify-breadcrumbs__item {
  &[disabled] {
    cursor: not-allowed;
    .amplify-breadcrumbs__link {
      background-color: var(
        --amplify-components-breadcrumbs__link-disabled-color
      );
      color: var(--amplify-components-breadcrumbs__link-disabled-color);
      pointer-events: none;
    }
  }
}

@esauerbo
Copy link
Contributor

@regularpersonn sorry for the churn on this. Discussed this further with the team, and it doesn't make sense to support isDisabled with Breadcrumbs because disabling links is not natively supported in html and is against web standards. I would recommend just rendering text instead of BreadCrumbs.Link for elements that you wish to disable.

I know the props tab for Breadcrumbs currently lists isDisabled and we're working to get that updated to avoid confusion in the future.

@esauerbo esauerbo added feature-request Request a new feature and removed bug Something isn't working labels Nov 28, 2023
@regularpersonn
Copy link
Author

That’s fair enough. Thanks!

@reesscot
Copy link
Contributor

We're closing out this feature request ticket as we don't plan on supporting this in Breadcrumbs due to the reasons mentioned above. Please open another ticket if you have further questions on use of Breadcrumbs components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature Primitive An issue or a feature-request for one or more UI Primitive
Projects
None yet
Development

No branches or pull requests

3 participants