-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
The "value" attribute of <input type="button"> should be directionality-capable #3330
Comments
Is it problematic if we apply this to all types of cc @whatwg/i18n |
I'd guess that applying it to all types of |
Ah, I think currently it follows from https://html.spec.whatwg.org/multipage/dom.html#the-directionality (note how that refers to the "value" concept) coupled with https://html.spec.whatwg.org/multipage/dom.html#directionality-of-the-attribute. That does currently exclude |
@annevk Values such as number, date, etc. shouldn't be directionality-capable since it is their local representation that's meant to be displayed and the The button case looks like an oversight to me: the |
So let's see. We want to change:
To include Submit Button, Reset Button, and Button. And we want to allow Note that we don't allow |
I think that's right. I guess technically they could be directional, but in practice they aren't. IIRC, Adlam is the only numbering system where the digits are RTL and I don't think that'll be used much for phone numbers? |
On reflection, I think my conclusion surrounding applying cc @r12a |
The button values are supplied by the web developer, but when submitted the button's value looks just like any other value. While the web developer might own the receiving process, it's probably easier and better if the directionality of all fields work in the same way, rather than some requiring the developer to remember what direction was applied to a control like a button. (Also, many web applications are localized, often dynamically, so that button's direction will vary according to the locale used to compose the page--and not always derivable from the locale itself) |
Thanks, that's compelling. I've folded that improvement into #9669 so we can keep this focused on "directionality". Two outstanding questions for this issue:
|
I agree that Telephone kind of "sticks out funny" and probably should not be an exception. I played with it here a bit. I noticed a bug in FF: |
The main effect would be whether https://www.w3.org/Bugs/Public/show_bug.cgi?id=17835 seems to cover the telephone change based on an extensive discussion with @aharon-lanin. I guess that argues for keeping it, even if it's a little weird. (This also makes me wonder if custom elements should be able to set their own directionality, but that might be some quite advanced bit of technology that's not really needed in practice.) |
Include the input Password state in the auto directionality algorithm to achieve consistency with input elements where the dirname attribute will apply as per the discussion in # #9669. Also include the input buttons, except for the Image Button. Notably this does not include the button element as there the contents of the element and the value are distinct concepts (value is only used for submission and not for rendering). Tests: ... Fixes #3330.
Include the input Password state in the auto directionality algorithm to achieve consistency with input elements where the dirname attribute will apply as per the discussion in # #9669. Also include the input buttons, except for the Image Button. Notably this does not include the button element as there the contents of the element and the value are distinct concepts (value is only used for submission and not for rendering). Tests: ... Fixes #3330.
This makes two changes: * Applies the auto directionality algorithm to Hidden, Password, Submit Button, Reset Button, and Button input elements. * Adds support for the dirname attribute to Password and Submit Button input elements. And it uses a shared concept between these two features so they will no longer diverge going forward. (The concept can still be shared despite Reset Button and Button input elements not supporting the dirname attribute as the concept is only consulted in form submission where those elements have already been filtered out.) Tests: web-platform-tests/wpt#42427 Fixes #3330 and fixes #9669.
In the list of "directionality-capable attributes" at [1], I was surprised to find that the "value" attribute of was not included, even though this attribute's text is clearly expected to be rendered.
A simple testcase
(where the Arabic text logically precedes the Latin) shows the button label rendered with LTR directionality (the Arabic text appears on the left, the Latin on the right) in both Firefox and Safari; however, in Chrome it renders with RTL directionality (Arabic on the right, Latin on the left).
AFAICS, this is a Chrome bug w.r.t. the current spec, as this attribute is not listed as directionality-capable, but I think it would make more sense from an author's point of view to align the spec (and other browsers) with Chrome's behavior here.
See also the Firefox bug report https://bugzilla.mozilla.org/show_bug.cgi?id=1428316.
[1] https://html.spec.whatwg.org/multipage/dom.html#directionality-capable-attribute
The text was updated successfully, but these errors were encountered: