File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed
Expand file tree Collapse file tree 3 files changed +23
-6
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 ;
171169
170+ // Position is set in JS to match the native input's offset.
171+
172172 pointer-events : none ;
173173}
174174
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 ;
211209
210+ // Position is set in JS to match the native input's offset.
211+
212212 pointer-events : none ;
213213}
214214
Original file line number Diff line number Diff line change @@ -68,11 +68,28 @@ const addClone = (
6868 if ( disabledClonedInput ) {
6969 clonedEl . disabled = true ;
7070 }
71+
72+ /**
73+ * Position the clone at the same offset as the native input to prevent the
74+ * placeholder from overlapping start slot content (e.g., icons).
75+ */
76+ const doc = componentEl . ownerDocument ! ;
77+ const isRTL = doc . dir === 'rtl' ;
78+
79+ clonedEl . style . top = `${ inputEl . offsetTop } px` ;
80+
81+ if ( isRTL ) {
82+ const parentWidth = ( parentEl as HTMLElement ) . offsetWidth ;
83+ const inputRight = parentWidth - inputEl . offsetLeft - inputEl . offsetWidth ;
84+ clonedEl . style . right = `${ inputRight } px` ;
85+ } else {
86+ clonedEl . style . left = `${ inputEl . offsetLeft } px` ;
87+ }
88+
7189 parentEl . appendChild ( clonedEl ) ;
7290 cloneMap . set ( componentEl , clonedEl ) ;
7391
74- const doc = componentEl . ownerDocument ! ;
75- const tx = doc . dir === 'rtl' ? 9999 : - 9999 ;
92+ const tx = isRTL ? 9999 : - 9999 ;
7693 componentEl . style . pointerEvents = 'none' ;
7794 inputEl . style . transform = `translate3d(${ tx } px,${ inputRelativeY } px,0) scale(0)` ;
7895} ;
You can’t perform that action at this time.
0 commit comments