New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
users/adamsiv/rtl-support #27027
users/adamsiv/rtl-support #27027
Conversation
This is a duplicate, there is already a PR that deals with LTR and RTL functionality |
Please don't commit the dist files as per the Contribution guidelines of this repository |
/CC @mdo: we really need to look into RTL support... |
@DigitalKrony: there are still dist files here (js/dist) |
…lKrony/bootstrap into users/adamsiv/rtl-support
There are still more dist files like the docs CSS and https://github.com/twbs/bootstrap/pull/27027/files#diff-2f2d399f0ea8844859fe5514b304733b |
js/src/util.js
Outdated
@@ -67,6 +67,13 @@ const Util = (($) => { | |||
|
|||
TRANSITION_END: 'bsTransitionEnd', | |||
|
|||
getPageDirection() { | |||
const htmlElement = document.getElementsByTagName('html')[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why you don't use document.documentElement
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was aiming for coverage and the dev docs around documentElement seemed unsure of IE and Edge support. If there's info surrounding coverage, I'd rather use it over the current implementation and would update accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You work for Microsoft, you should be able to learn about it from the inside :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But joking aside, works fine for me on latest Edge that ships with 10 stable and IE 11 and IE 10 (emulated).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those worked for me as well. And Emulated doesn't always do the trick. #trustMe.
However, I ran it through some rough and quick tests on Browser Stack, seemed to work as expected. At least on Win10. If someone else wants to roll back to win7 and Vista and test it, please send me your findings. Making the update now.
Thanks a lot @DigitalKrony, as @wolfy1339 mentions there are other rtl PRs, including this one open: @mdo, I agree with @XhmikosR we do need to address rtl. If we are following this solution I'd rather use |
Thanks, @andresgalante, for dropping in. Were we consolidating into one PR or am I updating this one to align to guidance? Happy to do either. Just hoping to get this landed sooner rather than later. |
@DigitalKrony it'll be up to @mdo to decide if this goes in and when. The thing to consider is that if this is creating a breaking change, it'll have to land in v5. |
# Conflicts: # scss/_carousel.scss # scss/mixins/_grid-framework.scss # scss/mixins/_grid.scss # site/_layouts/redirect.html
Unfortunately, it's not my decision to make. I know for sure this should have been addressed a long time ago for sure. For reference https://github.com/twbs/bootstrap/pulls?utf8=%E2%9C%93&q=is%3Apr+rtl |
RTL support would indeed be nice! I'm not familiar with making rtl websites, but was curious how this was done, so I have set up this PR locally to check some things. I think in some cases the changes don't really change anything. Like here: Lines 34 to 35 in c424555
or here: Lines 108 to 109 in c424555
and some other places. About the carousel, I don't know if this is the behaviour we want: And some dropdowns are broken: @DigitalKrony, I assume you did a find-and-replace of the |
@MartijnCuppens - I actually didn't do a find replace, I went file by file and corrected the issues I saw for each component by hand. However, this has been sitting, waiting to merge in for such a long time, that errors have started to work their way in. The screenshots that you've posted above, I remember having to massage out of the code when I first did my integration. I'll re-merge and do the work again. |
So I've gone back and reviewed the branch for the comments and inconsistencies mentioned above.
|
@MartijnCuppens - Thanks for taking the time. Can you do a pull and let me know if you see anything else. I'd like to make sure we have this right when it's some to get it merged in. I have a lot of folks on my end REALLY looking forward to this being merged and released. |
@DigitalKrony, I'm glad you're so driven to help Bootstrap with the RTL support but I'm afraid I can only review a limited part of this PR. I'm not familiar with rlt languages myself and I think we'll need reviews from several people who are used to make rtl websites before a PR can be merged. |
@mdo hey there, any idea when this might be integrated? |
RTL is easy, in principal think of it as a mirror for LTR content, anything going from left-to-right should go from right-to-left (so right is "preceding" and left is "following"), anything aligned to the left should be aligned to the right, any left-arrow (indicating "previous") should be a right-arrow, etc. "Mirrored" is the key, it's pretty straight forward. See bootstrap.rtlcss.com for example. |
Crazy threads about RTL in Bootstrap :)) |
There is no technical reason for Bootstrap's lack of RTL support, with around 540 million Arabic/Persian/Hebrew speakers worldwide - no question regarding the necessity. I was just pointing out the obvious, that RTL is a visual mirror of LTR (alignment, floating, margin, padding wise etc). This has nothing to do with the languages themselves and can be fully supported and tested with English. |
Zurb Foundation for Sites 6 has a very long experience in RTL support. And they enable RTL by one $global-text-direction: ltr !default;
$global-left: if($global-text-direction == rtl, right, left);
$global-right: if($global-text-direction == rtl, left, right); Bootstrap team is waiting for the perfect solution to support RTL, which will not come in the near future or maybe ever?. |
@mdo hi there, we chatted a few months ago about seeing if this could be included in the next minor release. Could you please provide an update? |
@mdo will this be merged in the future, or should we consider this dead? |
We're looking at tackling RTL in v5! See #30980 for details. Sorry we didn't get to do this for v4, maybe we'll still be able to bridge these major versions once we tackle this in v5. Please weigh in on the new PR and referenced issues with any feedback moving forward! <3 |
On behalf of Microsoft, I'm submitting this pull-request.
We have taken Bootstrap 4.x on as a dependency for a project, however, we have requirements for our websites to work in an international arena as well as maintain perf goals and an easy dev story. To that end, the best case in order to align these things is to integrate internationalization directly into Bootstrap. You'll find the appropriate update within.
The chages in the files below simply add in the
dir
attribute to the HTML tag to allow ease of testing. While testing the RTL story wihtin the doc site, these must be set to"rtl"
.The update to the SCSS is realativly simple. I've added three variables to the
_variables.scss
.These three variables work in conjunction with eachother. By
!default
$dir
is set toltr
. Following this varaible, there's$left
and$right
. These two variables are set via a function (set-dir(left|right)
) base on the value of$dir
for ease of use. The$dir
variable also sets a globaldirection: $dir
style decloration to capture finer style requirements for things like inputs and sudo elements.