ionic-team / ionic-team/ionic-framework

bug(input, select): changing font size with label-placement="floating" causes incorrect label position

Đang mở
#27,194 12 bình luận 2 reaction 0 người được giao Xem trên GitHub
package: core type: bug
Ngôn ngữ chính
TypeScript
Star
52.7k
Fork
13.3k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
51

Mô tả

### 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

The floating label placement of an outlined `` seems buggy in my applications so i debugged in and mentioned that the current implementation is not very consistent and for example breaks if you set for example a different font size.

Atm the label is placed by (select example):
```css
:host(.select-label-placement-floating) .label-text-wrapper {
transform: translateY(100%) scale(1);
}
```

what only works if the label (the `label-text-wrapper` element) has1/3 of the height of the select itself as far as i understand. This stops working if you set a different font size on a input/select.

### Expected Behavior

The implementation should force the label to be always centered in the middle. For example:

```css
:host(.select-label-placement-floating) .label-text-wrapper {
top: 50%;
transform: translateY(-50%) scale(1);
}
```
and then of course reset the top property on other states

### Steps to Reproduce

Change the font size on a md outlined floating label select or input element

### Code Reproduction URL

_No response_

### Ionic Info

Let me know if required

### Additional Information

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by locating the CSS for outlined floating-label states in the ion-select and ion-input components. Reproduce the issue by changing the font size on a Material Design outlined floating-label control, then compare label placement across the affected states. Done means the label remains centered at different font sizes without breaking other label placements.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
css, typescript
Lĩnh vực
design, frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.