Skip to content

Commit

Permalink
fix: πŸ› update rtl support function to fix rtl support
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelo Portugal authored and mportuga committed Oct 26, 2020
1 parent 3a5ac8a commit 75580b8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/core/src/js/services/ui-grid-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
return rtlScrollType.type;
}

var definer = angular.element('<div dir="rtl" style="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll">A</div>')[0],
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],
type = 'reverse';

document.body.appendChild(definer);
Expand All @@ -1018,9 +1018,16 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
type = 'default';
}
else {
definer.scrollLeft = 1;
if (definer.scrollLeft === 0) {
type = 'negative';
if (typeof Element !== 'undefined' && Element.prototype.scrollIntoView) {
definer.children[0].children[1].scrollIntoView();
if (definer.scrollLeft < 0) {
type = 'negative';
}
} else {
definer.scrollLeft = 1;
if (definer.scrollLeft === 0) {
type = 'negative';
}
}
}

Expand Down

0 comments on commit 75580b8

Please sign in to comment.