Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#26824 closed defect (bug) (fixed)

Always ltr input elements

Reported by: dll1024's profile dll1024 Owned by: yoavf's profile yoavf
Milestone: 3.9 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch 2nd-opinion
Focuses: rtl Cc:

Description

some input element must be always ltr. for example URL or Email address is always english and it have bad view in rtl inputboxes.

Attachments (5)

always-ltr-elements.png (25.9 KB) - added by dll1024 11 years ago.
An Example
26824.diff (1.5 KB) - added by MikeHansenMe 11 years ago.
26824.2.diff (1.5 KB) - added by MikeHansenMe 11 years ago.
removes code class and add input type url to css
26824.3.diff (3.6 KB) - added by yoavf 11 years ago.
26824.4.diff (3.1 KB) - added by yoavf 11 years ago.

Download all attachments as: .zip

Change History (16)

@dll1024
11 years ago

An Example

#1 @dll1024
11 years ago

It can fix by adding a class="ltr" attribute to this elements and add a css code for it.

html:

<input type="email" name="myemail" class="ltr" />

css:

.ltr{direction:ltr;}

#2 @MikeHansenMe
11 years ago

I think it would be better to avoid adding a class to the input. If all email inputs need to be ltr a simple rule input[type="email"] would work.

#3 @nacin
11 years ago

  • Component changed from RTL to Administration
  • Focuses rtl added

We automatically LTR an element with the "code" class, at the very least. I could be OK with a class here but yes, an attribute selector would be nice if possible. (I'd prefer a semantic class like "email" rather than "ltr", though.)

#4 @MikeHansenMe
11 years ago

It looks like some of the url input already have a class of code on them. Would it be best to update these from type="text" to type="url" then adding a rule like the following?

input[type="email"],input[type="url"]{
  direction: ltr;
}

@MikeHansenMe
11 years ago

#5 @MikeHansenMe
11 years ago

  • Keywords has-patch needs-testing added

@MikeHansenMe
11 years ago

removes code class and add input type url to css

@yoavf
11 years ago

#6 @yoavf
11 years ago

  • Keywords needs-testing removed
  • Owner set to yoavf
  • Status changed from new to accepted

Input types such as email and url are not supported on all browsers
However, they default to text, so I think this patch is good to go. It will offer improvement to modern browsers while being backward compatible and future proof.

With 26824.3.diff I updated the patch so that the CSS is in the forms.css file, and also changed the form types of the url and email field in the general settings screen.

#7 @yoavf
11 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.9

#8 follow-up: @nacin
11 years ago

  • Keywords 2nd-opinion added; commit removed
  • Type changed from enhancement to defect (bug)

I think there are some reasons why some of these fields are not yet type="url" or type="email". For type="email", there are validation issues: #22183. I imagine type="url" has similar not-yet-seen issues.

@yoavf
11 years ago

#9 in reply to: ↑ 8 @yoavf
11 years ago

Replying to nacin:

I think there are some reasons why some of these fields are not yet type="url" or type="email". For type="email", there are validation issues: #22183. I imagine type="url" has similar not-yet-seen issues.

Ok, in this case let's standardise on '.ltr' for the class, and add it to the missing field.
26824.4.diff

#10 @nacin
11 years ago

I see a few issues:

  • The new patch removes the code class, which specifies styling in addition to direction. Adding the ltr class here would be redundant.
  • The only element the patch changes from RTL to LTR is a single email field. We have a lot of email fields, and it would be good for them to all be consistent.

At this point I realized that the ltr class is already used in core, but we lost it when we moved to cssjanus. So, I'm restoring it, and adding the ltr class in the one place it is missing.

#11 @nacin
11 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 27743:

Fix LTR field handling:

  • Restore .ltr class lost in the conversion to RTL as a build process.
  • Make email and url inputs always LTR.
  • Set an email field on user-edit to be LTR.

props MikeHansenMe, yoavf for initial patches.
fixes #26824.

Note: See TracTickets for help on using tickets.