Placeholder Text need to support RTL

RESOLVED INVALID

Status

RESOLVED INVALID
4 years ago
4 years ago

People

(Reporter: pivanov, Assigned: pivanov)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [rtl-meta])

Attachments

(1 attachment)

We need to add:
`
html[dir="rtl"] ::-moz-placeholder {
  text-align: right;
}
`
in to [BB][input_areas] and check other [BB]
Created attachment 8467677 [details] [review]
patch for Gaia/master

Need to check other [BB]

Comment 2

4 years ago
Pavel, do we need a reviewer for this patch? Please let me know the status and, if so, we can flag a suggested reviewer and request approval for uplift if that goes well. Thank you.
Flags: needinfo?(pivanov)
Working on it
Flags: needinfo?(pivanov)
Pavel, I wonder if we can use :-moz-dir here to handle the 4 possible cases

Case 1) LTR View + LTR Placeholder text = Placeholder text aligned left
Case 2) LTR View + RTL Placeholder text = Placeholder text aligned right
Case 3) RTL View + RTL Placeholder text = Placeholder text aligned right
Case 4) RTL View + LTR Placeholder text = Placeholder text aligned left

and have something like

/* Case 1 */
::-moz-placeholder:-moz-dir(ltr) {
  text-align: left;
}
/* Case 2 */
::-moz-placeholder:-moz-dir(rtl) {
  text-align: right;
}
/* Case 3 */
html[dir="rtl"] ::-moz-placeholder:-moz-dir(rtl) {
  text-align: right;
}
/* Case 4 */
html[dir="rtl"] ::-moz-placeholder:-moz-dir(ltr) {
  text-align: left;
}


Now that I'm not sure if this is technically possible right now, however I guess this is a neat way to approach the bug and handle all at once..
What do you think ? :)
Flags: needinfo?(pivanov)
Hey,

if you have time feel free to get this one ... I'm overloaded at this moment.

I'm not sure whether it works but It looks good :)
Flags: needinfo?(pivanov) → needinfo?(nefzaoui.ahmed)
(In reply to Pavel Ivanov [:ivanovpavel] from comment #0)
> We need to add:
> `
> html[dir="rtl"] ::-moz-placeholder {
>   text-align: right;
> }
> `
> in to [BB][input_areas] and check other [BB]

So I finally checked this, and it seems like Gecko does it without the need for any additions. So if the html tag has dir="rtl", Gecko automatically switches the placeholder direction to "right".
Pavel, is there anywhere in Firefox OS where this isn't the case?

To go further with the idea we can get a little smarter about this (as comment 4 suggests) we can have it like changing the direction of the placeholder text not only based on the document direction but also on the language (e.g. sometimes you have English placeholder text in a right-to-left document).

HOWEVER

1) IMHO I think this should better be done in Gecko instead of Firefox OS' Gaia and win this feature for all the platforms :)
2) -moz-dir doesn't seem to count the placeholder text as content to depend on when deciding what language is being used. Which is in itself a problem and could require another bug filed for it.

Will be looking into it if you don't mind. :)

Needinfo'ing Pavel for the question in this comment.
Flags: needinfo?(nefzaoui.ahmed) → needinfo?(pivanov)
yeah ... I I agree with 1) we need to check this from Gecko side
Flags: needinfo?(pivanov)
Mass Edit: adding the [rtl-meta]
Whiteboard: [rtl-meta]
Pavel, is this still a valid issue?
Flags: needinfo?(pivanov)
I think is not valid anymore
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Flags: needinfo?(pivanov)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.