patternfly / patternfly/patternfly-react
Input Components - Simplify Interface by handling FormGroup internally
未关闭
还没有人认领这个 Issue。
Breaking change :boom:
Pinned
- 主要语言
- TypeScript
- 星标
- 862
- 派生
- 392
- 平均合并
- 4 天 8 小时
- 30 天内合并 PR
- 9
描述
Labels and inputs in html are hooked together by ID.
<label for="username">Enter your username:</label>
<input id="username" />
In PF4 to get a label on an input requires a FormGroup.
<FormGroup
id="user-form-group"
fieldId="user"
label="User"
helperText="User help text"
isRequired
validated={error ? 'error' : undefined}
helperTextInvalid={error}
>
<TextInput
id="user"
type="text"
aria-describedby="user-form-group"
isRequired
validated={error ? 'error' : undefined}
placeholder="Enter user"
value={user}
onChange={onChange}
/>
</FormGroup>
It make for a streamlined developer experience if that logic could be hidden from the developer. On a input component, if a label is provided, then the component could handle all the logic internally.
<TextInput
id="user"
label="User"
helper="User help text"
type="text"
required
placeholder="Enter user"
value={user}
onChange={onChange}
error={error}
/>
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先查看现有的输入组件和 FormGroup 实现,以了解它们当前的职责和公共 API。比较标签、IDs、辅助文本、必填状态、验证和错误的处理方式,然后定义组件行为以及所需的测试,以确认带标签的输入无需显式 FormGroup 即可正常工作。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react, typescript
- 领域
- frontend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 30/100