adobe/react-spectrum

[RAC] `Section` cannot have arbitrary elements as `children`?

Open

#5.399 aberto em 9 de nov. de 2023

Ver no GitHub
 (3 comments) (0 reactions) (0 assignees)TypeScript (1.500 forks)auto 404
help wanted

Métricas do repositório

Stars
 (15.634 stars)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

Provide a general summary of the issue here

From the documentation, I had expected <Section/> component to allow arbitrary children, as long as I render a <Collection/> and <Header/> somewhere in there. But it looks like it expects <Header/> and <Collection/> as immediate children, and any additional elements will break?

Here's a reproducing link:

https://codesandbox.io/s/section-test-lgclvl?file=/src/App.tsx

This currently renders an empty list box. Removing the "Remove me!!" element will fix the issue and render the items.

🤔 Expected Behavior?

<Section/> allows arbitrary children, or documentation should describe this restriction.

😯 Current Behavior

If anything besides <Header/> or <Collection/> are used in the children prop, the collection appears empty. (Actually the BaseCollection appears to have a valid key map, but firstKey is null).

💁 Possible Solution

Not sure if this is a bug or working as intended?

🔦 Context

In Plasmic, we want to allow users to style react-aria-components in a visual editor.

🖥️ Steps to Reproduce

https://codesandbox.io/s/section-test-lgclvl?file=/src/App.tsx

Version

react-ria-components@1.0.0-rc.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Ubuntu

🧢 Your Company/Team

Plasmic

🕷 Tracking Issue

No response

Guia do colaborador