ionic-team / ionic-team/ionic-framework

bug: IonInput with clearInput causes placeholder text to not be centered

未关闭
#27,138 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
package: core type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v7.x

### Current Behavior

When rendering an `ion-input` with the `clear-input` option enabled, it will cause centered placeholder text to be shifted by the space that the clear button would render, when a value is set.

### Expected Behavior

The clear button should not take up available space until the control has a value. For example, the Reminders app from iOS:

|Without Value|With Value|
|---|---|
|Even spacing on each side (`115px`)|No longer centered to entire container|
|![IMG_4627](https://user-images.githubusercontent.com/13732623/230496377-a5cd1b70-9fe1-490b-a1ec-150977b9965f.PNG)|![IMG_4628](https://user-images.githubusercontent.com/13732623/230496404-29483bd1-bf38-4547-a04c-8af06ef1b0b2.PNG)|

### Steps to Reproduce

1. Open the reproduction
2. Observe: The placeholder text is shifted when the `clear-input` is enabled, even if there is no value set.

### Code Reproduction URL

https://stackblitz.com/edit/m9gigw?file=index.html

### Ionic Info

N/A

### Additional Information

The visually centered placeholder is present in iOS 16.4, but in the 16.5 beta there is different visual behavior in the reminders app. We are unsure if it is a bug or a change in design at this time.

Attaching video comparisons of difference in behavior we are currently seeing across iOS versions with the iOS Reminders app:

|iOS 16.4|iOS 16.5 beta|
|---|---|
||

贡献指南

打开贡献指南

调研方向

Open the StackBlitz reproduction at index.html and run it with an ion-input using clear-input enabled. Compare the placeholder position with and without a value, and consider the issue done when the empty control keeps its placeholder centered while the clear button appears correctly for a populated control.

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

评估

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

把新 issue 发到你的邮箱

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