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

Directionality of input element whose type attribute is in the Telephone state #6140

Closed
MyidShin opened this issue Nov 10, 2020 · 7 comments
Closed
Labels
i18n-afrlreq Notifies African languages experts of relevant issues i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. interop Implementations are not interoperable with each other topic: forms

Comments

@MyidShin
Copy link

In the section of the dir attribute, the paragraph says:

If the element is an input element whose type attribute is in the Telephone state, and the dir attribute is not in a defined state (i.e. it is not present or has an invalid value)
The directionality of the element is 'ltr'.

This doesn't match what Chrome, Safari, and Firefox currently do, and rather, browsers treat it as the following contents of the paragraphs as the other elements.

If the element has a parent element and the dir attribute is not in a defined state (i.e. it is not present or has an invalid value)
The directionality of the element is the same as the element's parent element's directionality.

I don't see a lot of value in making type=tel special. I think that we could have no special rule for directionality of input element having type=tel.
WDYT?

@annevk annevk added i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. interop Implementations are not interoperable with each other topic: forms labels Nov 10, 2020
@annevk
Copy link
Member

annevk commented Nov 10, 2020

Seems reasonable to match implementations, though might be good to get input from @whatwg/i18n.

@amire80
Copy link

amire80 commented Nov 10, 2020

Well, I would see value in making it ltr by default in most languages. Of course, developers can set the correct direction manually, but I use Hebrew RTL websites all the time, and I see that many developers don't do it, and making a better default would be nice. (I'd also love to see the same for credit card numbers.)

However, it shouldn't always be ltr. Languages written in the N'Ko alphabet would have to be rtl, because they write numbers from right to left.

@r12a r12a added i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues labels Nov 11, 2020
@aphillips
Copy link
Contributor

@amire80 I agree with most of your comment. Telephone numbers are kind of special as input, since they are numbers that are usually separated by neutrals or spaces.

Thinking out loud... Would setting the base direction to auto work? Or we might need a special form of auto, since most digits are weakly directional. Making the default ltr would work most of the time, since we're talking base direction here and since scripts like N'Ko that write numbers RTL have digits that generally have a strong RTL direction. We'd mainly be dealing with edge effects, notably on the + symbol.

@xfq xfq added the i18n-afrlreq Notifies African languages experts of relevant issues label Nov 13, 2020
@dbaron
Copy link
Member

dbaron commented Sep 13, 2023

It looks like this is being implemented in browsers, e.g., in WebKit/WebKit#15273 and https://chromium-review.googlesource.com/c/chromium/src/+/4851878 .

It's worth noting that the spec probably does require a style sheet change, in addition to the style sheet chunk proposed in #3699 (comment) , to reflect that inputs with type=tel should have direction: ltr when they have no dir attribute, probably either:

input[type="tel" i]:dir(ltr) {
  direction: ltr;
}

or

input[type="tel" i]:not([dir]) {
  direction: ltr;
}

Otherwise we end up with the HTML spec's concept of direction not being reflected into the direction property for a special case.

@annevk
Copy link
Member

annevk commented Sep 18, 2023

Thank you for surfacing this issue @dbaron! See also #3330 (comment) for more background as to why we want to preserve the Telephone special case after all.

I think Telephone is already covered using your first suggestion:

[dir]:dir(ltr), bdi:dir(ltr), input[type=tel i]:dir(ltr) { direction: ltr; }

or would some further change be warranted?

(I suspect #9689 is not impacted here as that would influence :dir which would end up doing the right thing.)

@annevk
Copy link
Member

annevk commented Oct 6, 2023

Closing this per my above comment. If there's anything I missed please do let me know.

@annevk annevk closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2023
@dbaron
Copy link
Member

dbaron commented Oct 24, 2023

Indeed, I see what I was saying there was already in the style sheet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n-afrlreq Notifies African languages experts of relevant issues i18n-alreq Notifies Arabic script experts of relevant issues i18n-hlreq Notifies Hebrew script experts of relevant issues i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. interop Implementations are not interoperable with each other topic: forms
Development

No branches or pull requests

7 participants