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

Bug: components that map children (eg Breadcrumb) break when using a fragment #844

Open
dbowling opened this issue Jan 6, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@dbowling
Copy link
Contributor

dbowling commented Jan 6, 2023

Steps to reproduce

Steps to reproduce

Introduce a fragment into the Breadcrumb.

A minimal, contrived example:

    <Breadcrumb aria-label="">
      <>
        <BreadcrumbLink href="/foo">
          Item One
        </BreadcrumbLink>
        <BreadcrumbItem>
          Item Two
        </BreadcrumbItem>
      </>
    </Breadcrumb>

Use case

This was encountered when trying to conditionally display breadcrumbs, where one branch of the operation required a fragment to wrap two breadcrumbs.

Possible workarounds

Working around this issue now by wrapping both individual breadcrumb items in their own conditional so there is never a fragment.

Expected Behavior

Renders two <li> items.

Actual Behavior

Renders a single <li> with two items inside. This has the effect of removing the separator between the breadcrumbs.

<ol>
  <li class="Breadcrumb__Item">
    <a class="Link Breadcrumb__Link" href="/foo">Item One</a>
    <span class="Breadcrumb__Item">Item Two</span>
  </li>
</ol>

Version

4.7.0

What browsers are you experiencing the problem on?

Firefox

Relevant log output

No response

Anything else we should know?

Additional information

Jason did some initial looking and found that this could impact several components, and is related to reactjs/rfcs#61

@dbowling dbowling added the bug Something isn't working label Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant