Inconsistent `Provider` placement in components

未关闭
#10,626 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
56/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
react, typescript
领域
frontend

调研方向

Read the discussion linked from the issue, then compare Provider placement in packages/react-aria-components/src/Select.tsx, NumberField.tsx, SearchField.tsx, and TextField.tsx. Determine the consistent placement that preserves context for render-prop containers, apply it across the affected components, and verify the behavior with the relevant component tests.

由索引模型根据 Issue 内容生成。

描述

Discussed in https://github.com/adobe/react-spectrum/discussions/10155

Originally posted by af-cf June 3, 2026
Hi. I noticed that certain components have an inconsistent placement of <Provider>. Sometimes it's the root element, sometimes it's not.

Examples:

I noticed when implementing RAC I would use render prop to render a generically styled form field container component, RAC components that do not have Provider as root would (for obvious reasons) not set the context props for elements like RAC label or error that are inside of that form field container component.

For now I am relying on testing as I implement to determine whether render prop works or not and then opt for nesting the field container component instead if render doesn't work. However I imagine ideally it should be consistent across all of the components that implement a provider.

More concrete examples in comment https://github.com/adobe/react-spectrum/discussions/10155#discussioncomment-17322355

主要语言
TypeScript
星标
16k
派生
1.6k
平均合并
4 天 3 小时
30 天内合并 PR
39

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

adobe/react-spectrum 的其他 Issue

查看 adobe/react-spectrum 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。