-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Right-to-left CSS (using module for conversion) #7072
Conversation
The language direction was stored in state twice -`textDirection` was used in the background, and `languageDirection` was used in the UI. `textDirection` is now used in both places instead.
A second stylesheet has been added to each HTML page for use with right-to-left locales. It is disabled by default. It is enabled on startup if a RTL locale is set, and when switching to a RTL locale. Similarly the LTR stylesheet is disabled when a RTL locale is used. Unfortunately there is an unpleasant flash of unstyled content when switching between a LTR and a RTL locale. There is also a slightly longer page load time when using a RTL locale (<1s difference). We couldn't think of an easy way to avoid these problems.
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.
This looks great, thanks!
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.
My earlier review was mainly from reviewing the code; I hadn't looked over the design in great detail at the time. After further review I have found a few issues that should probably be addressed if they're not too challenging
I found a few more icons that seem like they should be flipped around:
ui/app/pages/send/send.scss
- The caret under.send__select-recipient-wrapper__list__back-caret
This is the caret next to the "Back to All" button in the "Send" flow (e.g. after clicking "Transfer between my accounts")ui/app/pages/settings/contact-list-tab/index.scss
- under.address-book__my-accounts-button__caret
This is in the 'Contacts' settings page, next to "My Wallet Accounts"ui/app/pages/settings/networks-tab/index.scss
- under.networks-tab__back-button
This is on the 'Networks' settings, possibly only in the browser-action popup UI (not fullscreen)
The toggle buttons in the settings seem pretty broken (e.g. on the 'Advanced' tab):
I don't think it'd be easy to make the toggle support RTL properly (we're using a library that isn't actively maintained). So maybe we should just leave the toggle as LTR for now, and replace that library at some point in the future. Or you could try to do something clever like reverse the styles and the values when using RTL.
I found a few input fields that should probably be set to left-to-right, as they're used for numbers or addresses:
ui/app/pages/send/send.scss
- the classens-input__wrapper__input
This is from the first page of the 'Send' flow, when choosing the recipient.ui/app/components/app/gas-customization/gas-modal-page-container/advanced-tab-content/index.scss
- the classadvanced-tab__gas-edit-row__input
This is on the screen for editing the gas value during the 'Send' flowui/app/components/aoo/gas-customization/advanced-gas-inputs/index.scss
- the class.advanced-gas-inputs__gas-edit-row__input
This is similar to the last one, except it's in the edit gas page of the side-bar that appears in some cases (e.g. when speeding up a transaction)- The id
search-token
. There are no classes for this, but you could add it toui/app/pages/add-token/index.scss
, or create a new file inui/app/pages/add-token/token-search
perhaps.
This is the field for adding new tokens. I'm a bit on the fence about this one - maybe it's fine as-is? But all of the tokens are left-to-right, so it seems like the search field should be as well perhaps. - Most of the fields in the Custom RPC form should probably be left-to-right? The first one is just a name, so that's fine as right-to-left, but the others are numbers, URLs, etc. I'm not sure what to do with these - I'll leave them to your discretion.
The styles for this are inui/app/pages/settings/networks-tab
- The 'Add site' field in the 'Connections' tab of the settings.
This one just uses a shared classname at the moment - I guess a new class could be added to the text field specifically, which could be put in/ui/app/pages/settings/connections-tab/index.scss
.
Phew - that's a lot of stuff! That's all I found at the moment. Please feel free to push back on any of these if you think the suggestion is wrong or misguided or not important enough to block this getting merged - I'm not a right-to-left user, so this is all pretty new to me.
f22ad30
to
cc0d5e5
Compare
cc0d5e5
to
047dbf4
Compare
Thanks for digging deep into the UI and finding these! I essentially agree with all of the changes, with these additional notes
For extra reading (or future maintainers reading the thread) I have a write-up on some RTL settings here https://mapmeld.com/rtl-guide/ |
I believe the caret written as a text string is in the breadcrumb component - as opposed to the one referenced in the stylesheet, which is alongside the "My Wallet Accounts" entry. It looks correct now in any case.
Looks much better! Though it would be nice if it was right-aligned.
I'm not entirely sure this was the best choice for the first field, since as a user-chosen name it could be either LTR or RTL. Leaving it as LTR seems fine for the time being though - we can always change it later.
Fantastic - using I noticed one more set of fields that should be made |
I think you're right to make This might also remove the need to put |
Yes, I think so |
OK I made your suggested changes but actually I don't know how to set the default attribute on TextField |
I believe this should do it: 57a6b0d This also allows you to remove any line where |
Alright, that default is added in. I've removed the rule from |
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.
Looks great, thanks! That covers everything for me.
Replacing #6822 with this smaller pull request, thanks to @Gudahtt
direction: ltr
on Identicon and 0x addresses) protected with an/*rtl:ignore*/
comment