DatePicker popup TimeField collapses when rendered inside Form

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

维护者通常 1 天内回复

@Sufiyan-MSA 已经在做这个了。

开始于 2026年11月1日。

  • #10915 来自 @costajohnt —— 已合并

评估

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

调研方向

The bug sits where Spectrum's DatePicker popup TimeField picks up React Aria's FormContext and applies grid-template-columns: subgrid. Start by reproducing with the StackBlitz linked in the issue, then check the computed grid styles on the popup's parent flex container. Done means the time input keeps its full width inside a Form with no change in behaviour outside one.

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

描述

Provide a general summary of the issue here

When a time-enabled Spectrum 2 DatePicker is rendered inside Spectrum’s Form, the time input in its calendar popup collapses, clipping the time segments.

The same picker renders its popup time input correctly outside Form.

Image
🤔 Expected Behavior?

The popup’s time input should remain wide enough to display and edit all time segments, regardless of whether the DatePicker is inside a Form.

😯 Current Behavior

The time input shrinks and is not wide enough to interact with properly.

💁 Possible Solution

The popup TimeField appears to inherit React Aria’s FormContext. Spectrum uses the presence of this context to enable grid-template-columns: subgrid.

However, the popup TimeField’s immediate parent is a flex container rather than the Form’s grid. Its computed grid-template-columns is none, and the input collapses to its minimum width.

🔦 Context

This affects a form containing date pickers. The date fields themselves fill the form correctly, but the time inputs are clipped and difficult to use.

🖥️ Steps to Reproduce

https://stackblitz.com/edit/yn2buesf?file=src%2FExample.tsx

  1. Open the page
  2. Open the calendar popup and observe that the Time input is collapsed
  3. Close the popup and replace the surrounding <Form> with <div>, leaving the picker unchanged
  4. Open the popup again. The Time input renders at its normal width
Version

@react-spectrum/s2 1.8.2

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

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

环境准备

从这里开始

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

adobe/react-spectrum 的其他 Issue

查看 adobe/react-spectrum 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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