adobe/react-spectrum

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

Open

#5.399 geöffnet am 9. Nov. 2023

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (1.500 Forks)auto 404
help wanted

Repository-Metriken

Stars
 (15.634 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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

Contributor Guide