Skip to content

Commit ca71072

Browse files
sijavbrandyscarney
authored andcommitted
fix(select): RTL fix for searchbar (#11355)
* fix(select): RTL fix for searchbar RTL fix for searchbar component * fix bad reference I forgot to refrence _isRTL * use platform variable instead of method * space indent instead of tab indent * Remove scss changes per request PR - #11342 - covers the scss, and is about done
1 parent 257b5fc commit ca71072

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/components/searchbar/searchbar.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,19 @@ export class Searchbar extends BaseInput<string> {
238238

239239
// Set the input padding start
240240
var inputLeft = 'calc(50% - ' + (textWidth / 2) + 'px)';
241-
inputEle.style.paddingLeft = inputLeft;
241+
if (this._plt.isRTL) {
242+
inputEle.style.paddingRight = inputLeft;
243+
} else {
244+
inputEle.style.paddingLeft = inputLeft;
245+
}
242246

243247
// Set the icon margin start
244248
var iconLeft = 'calc(50% - ' + ((textWidth / 2) + 30) + 'px)';
245-
iconEle.style.marginLeft = iconLeft;
249+
if (this._plt.isRTL) {
250+
iconEle.style.marginRight = iconLeft;
251+
} else {
252+
iconEle.style.marginLeft = iconLeft;
253+
}
246254
}
247255
}
248256

@@ -257,11 +265,19 @@ export class Searchbar extends BaseInput<string> {
257265
var cancelStyle = cancelStyleEle.style;
258266
this._isCancelVisible = showShowCancel;
259267
if (showShowCancel) {
260-
cancelStyle.marginRight = '0';
268+
if (this._plt.isRTL) {
269+
cancelStyle.marginLeft = '0';
270+
} else {
271+
cancelStyle.marginRight = '0';
272+
}
261273
} else {
262274
var offset = cancelStyleEle.offsetWidth;
263275
if (offset > 0) {
264-
cancelStyle.marginRight = -offset + 'px';
276+
if (this._plt.isRTL) {
277+
cancelStyle.marginLeft = -offset + 'px';
278+
} else {
279+
cancelStyle.marginRight = -offset + 'px';
280+
}
265281
}
266282
}
267283
}

0 commit comments

Comments
 (0)