Skip to content
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

RTL UI has some reversed features #3910

Closed
yarons opened this issue Jan 19, 2023 · 8 comments · Fixed by #4353
Closed

RTL UI has some reversed features #3910

yarons opened this issue Jan 19, 2023 · 8 comments · Fixed by #4353
Labels
bug Something is broken or not working as expected i18n Internationalisation - related to translation into different languages

Comments

@yarons
Copy link

yarons commented Jan 19, 2023

URL

No response

How to reproduce the issue?

Simply login and switch to any RTL language, you'll see that the search box has overlapping words and that the buttons on the top right are clipped on the wrong side (due to hard coded left/right style arguments).

Screenshot(s) or anything else?

image

Which deployed environments do you see the issue in?

Released version at openstreetmap.org/edit

What version numbers does this issue effect?

No response

Which browsers are you seeing this problem on?

Firefox

@tyrasd tyrasd added bug Something is broken or not working as expected good first issue Issues that require little knowledge of the codebase labels Jan 25, 2023
@danieldegroot2
Copy link
Contributor

cc: @gravitystorm This issue should be moved to openstreetmap/openstreetmap-website.

@gravitystorm gravitystorm transferred this issue from openstreetmap/iD Jan 26, 2023
@biswajit-k
Copy link

I think it can be resolved by adding styles for placeholder for RTL language, @gravitystorm could you please let me know if this is correct? I can work on this.

@yarons
Copy link
Author

yarons commented Jan 26, 2023

CSS supports such behavior:
https://stackoverflow.com/questions/22511460/css-dir-rtl-vs-style-directionrtl (The resolving answer)

I can try and tinker with the CSS in my browser and take a screenshot of it if it helps.
Thanks!

EDIT

It's not only the placeholder, look at the buttons on top (There's a small glitch and one of the lines is thicker, I'm sure it can be fixed):
image

@tomhughes
Copy link
Member

It can be fixed yes, my draft fix is to replace https://github.com/openstreetmap/openstreetmap-website/blob/master/app/assets/stylesheets/common.scss#L29 with:

[dir=rtl] {
  /* no-r2 */ text-align: right;

  ::placeholder {
    /* no-r2 */ text-align: right;
  }
}

[dir=ltr] {
  /* no-r2 */ text-align: left;

  ::placeholder {
    /* no-r2 */ text-align: left;
  }
}

That works, though in my (english) browser the cursor winds up at the wrong end but I'm guessing that won't be the case if your browser is configured for an RTL language?

@biswajit-k
Copy link

For me, it still shows the placeholder text on the left, I think it is because dir => "auto" attribute is set on the input field. Also, dir set to auto always displays placeholder text on the left irrespective of the language. So, I think we should remove the dir attribute for the input fields and let the input and placeholder text be left or right-aligned based on the language selected.
I referred below-
A similar issue and an attempted fix

@yarons
Copy link
Author

yarons commented Jan 26, 2023

I'm not sure if we can do it but we can use CSS vars but it may solve this issue, we simply need to avoid the "auto" configuration and set the style for this field instead.
If I'm adding direction: rtl to the CSS it looks great, not sure why is doesn't inherit that from the HTML property.
Thanks :)

@gravitystorm gravitystorm added i18n Internationalisation - related to translation into different languages and removed good first issue Issues that require little knowledge of the codebase labels Feb 1, 2023
@Vel-12 Vel-12 mentioned this issue Feb 9, 2023
Vel-12 added a commit to Vel-12/openstreetmap-website that referenced this issue Feb 9, 2023
@gravitystorm
Copy link
Collaborator

We need to be very careful here that we aren't creating more problems than we are fixing. For example, there is a proposal in a comment here to remove dir="auto" from input fields, as an attempt to fix the placeholder problem, but we also have an open issue to add dir="auto" to all input fields.

I find this topic is usually more complex than it first looks, and I don't want to see us rush into trying to solve one thing while accidentally making lots of other things worse.

@yarons
Copy link
Author

yarons commented Feb 9, 2023

You're absolutely right, usually I'm using [dir="rtl"] to make sure it won't affect the LTR variant.

But we haven't discussed the buttons at all and these are also broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken or not working as expected i18n Internationalisation - related to translation into different languages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants