File tree Expand file tree Collapse file tree 3 files changed +21
-8
lines changed
Expand file tree Collapse file tree 3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 165165// otherwise the .input-cover will not be rendered at all
166166// The input cover is not clickable when the input is disabled
167167.cloned-input {
168- @include position (0 , null, 0 , 0 );
169-
170168 position : absolute ;
171-
172169 pointer-events : none ;
173170}
174171
Original file line number Diff line number Diff line change 205205// otherwise the .input-cover will not be rendered at all
206206// The input cover is not clickable when the input is disabled
207207.cloned-input {
208- @include position (0 , null, 0 , 0 );
209-
210208 position : absolute ;
211-
212209 pointer-events : none ;
213210}
214211
Original file line number Diff line number Diff line change @@ -68,11 +68,30 @@ const addClone = (
6868 if ( disabledClonedInput ) {
6969 clonedEl . disabled = true ;
7070 }
71+
72+ /**
73+ * Position the clone to match the native input's exact position and size
74+ * to prevent the placeholder from overlapping start slot content (e.g., icons).
75+ */
76+ const doc = componentEl . ownerDocument ! ;
77+ const isRTL = doc . dir === 'rtl' ;
78+ const inputRect = inputEl . getBoundingClientRect ( ) ;
79+ const parentRect = ( parentEl as HTMLElement ) . getBoundingClientRect ( ) ;
80+
81+ clonedEl . style . top = `${ inputRect . top - parentRect . top } px` ;
82+ clonedEl . style . width = `${ inputRect . width } px` ;
83+ clonedEl . style . height = `${ inputRect . height } px` ;
84+
85+ if ( isRTL ) {
86+ clonedEl . style . right = `${ parentRect . right - inputRect . right } px` ;
87+ } else {
88+ clonedEl . style . left = `${ inputRect . left - parentRect . left } px` ;
89+ }
90+
7191 parentEl . appendChild ( clonedEl ) ;
7292 cloneMap . set ( componentEl , clonedEl ) ;
7393
74- const doc = componentEl . ownerDocument ! ;
75- const tx = doc . dir === 'rtl' ? 9999 : - 9999 ;
94+ const tx = isRTL ? 9999 : - 9999 ;
7695 componentEl . style . pointerEvents = 'none' ;
7796 inputEl . style . transform = `translate3d(${ tx } px,${ inputRelativeY } px,0) scale(0)` ;
7897} ;
You can’t perform that action at this time.
0 commit comments