adobe / adobe/react-spectrum

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

Open
#5,399 3 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the issue here

From the documentation, I had expected `` component to allow arbitrary children, as long as I render a `` and `` somewhere in there. But it looks like it expects `` and `` 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?

`` allows arbitrary children, or documentation should describe this restriction.

### 😯 Current Behavior

If anything besides `` or `` 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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.