Skip to content

Commit 75580b8

Browse files
Marcelo Portugalmportuga
authored andcommitted
fix: 🐛 update rtl support function to fix rtl support
1 parent 3a5ac8a commit 75580b8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/core/src/js/services/ui-grid-util.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
10091009
return rtlScrollType.type;
10101010
}
10111011

1012-
var definer = angular.element('<div dir="rtl" style="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll">A</div>')[0],
1012+
var definer = angular.element('<div dir="rtl" style="width: 1px; height: 1px; position: fixed; top: 0px; left: 0px; overflow: hidden"><div style="width: 2px"><span style="display: inline-block; width: 1px"></span><span style="display: inline-block; width: 1px"></span></div></div>')[0],
10131013
type = 'reverse';
10141014

10151015
document.body.appendChild(definer);
@@ -1018,9 +1018,16 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
10181018
type = 'default';
10191019
}
10201020
else {
1021-
definer.scrollLeft = 1;
1022-
if (definer.scrollLeft === 0) {
1023-
type = 'negative';
1021+
if (typeof Element !== 'undefined' && Element.prototype.scrollIntoView) {
1022+
definer.children[0].children[1].scrollIntoView();
1023+
if (definer.scrollLeft < 0) {
1024+
type = 'negative';
1025+
}
1026+
} else {
1027+
definer.scrollLeft = 1;
1028+
if (definer.scrollLeft === 0) {
1029+
type = 'negative';
1030+
}
10241031
}
10251032
}
10261033

0 commit comments

Comments
 (0)