fix(components): [input] prevent layout shift when toggling clear icon#23661
Conversation
📝 WalkthroughWalkthroughReworks the input component's clear-icon rendering: DOM presence is gated by Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
|
Size Change: +106 B (+0.01%) Total Size: 1.66 MB
|
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
|
🧪 Playground Preview: https://element-plus.run/?pr=23661 |
|
This seems to change the layout when a suffix icon is present. play |
|
oh yes, it's inevitable, for some layouts the input will include the clear icon width like you demonstrate. |
I found an earlier discussion and a result that actually looked quite good, but I’m not sure why it was put on hold. Maybe moving the clear icon before the suffix would be a better approach. What do you think? |
|
I tried the solution of #10534 and it allocate a space for the clear icon too and the breaking change is more present because of the change icon order. |
|
Ok i see now, i have moved the clear icon onto the right of the suffix icon 👍 . I though to deplace the password toggle too but if we do that we probably want to do it for the valideIcon too so to keep it simple and avoid too much unexpected layout, we deplace only the clear icon and thinking at it again, the order is actually subjective so it's fine with the current status quo. |


fix #15869
fix #23981
Before:

before demo
Summary by CodeRabbit
Style
Bug Fixes