Comments (10)
I should clarify that the old implementation behavior prior to the recent change was that a dir=auto
element that contained no strong characters would fall back to ltr
.
from html.
I would suggest we revert to the behavior it had for a very long time. The upside is not worth the downstream cost.
from html.
A little more history here:
In November 2010, dir=auto
was added in fd6901d, fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=10808, with the behavior that dir=auto
elements with no strong characters are ltr
.
In April 2013, in work tied to https://www.w3.org/Bugs/Public/show_bug.cgi?id=17835, b00c2b0 added the rule that dir=auto
elements inherit parent directionality if they have no strong characters and are not a <bdi>
.
In June 2013, also tied to https://www.w3.org/Bugs/Public/show_bug.cgi?id=17835, b967fb3 removed the exception for <bdi>
that was added in April 2013.
In July 2013, fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=17835#c21, 773c6d1 changed the rule from being that elements inherit the parent directionality if they have no strong characters, to that they only inherit the parent directionality if they are empty (and nonempty elements with no strong characters are LTR).
In August 2014, without clear explanation, d2021df changed the rule from only empty element inheriting from the parent (and non-empty elements without strong characters being ltr) to instead being that any elements without strong characters inherit from the parent. (This undid the July 2013 change, and went back to the June 2013 state.)
I believe the spec behavior for this case has not changed since then.
I should test which of the above behaviors existing implementations follow.
from html.
from html.
There will certainly be cases where dir=auto
containing no strongly directional characters results in broken display by applying either of the specific directions (either ltr
or rtl
). The bidi isolation of the element will help prevent broader spillover effects, but the element itself can still be broken.
My guess is that forcing ltr
is wrong because RTL content authors would then have no control over the direction of dir=auto
content. Many RTL language pages declare direction on e.g. the html
element and don't repeated it internally.
Note that I18N's staff contact has changed (@r12a is still around, but please copy... @xfq)
from html.
I tend to agree with @annevk
But @jfkthame might have other opinions.
from html.
Note that the behavior it had "for a very long time" was because we didn't address bidirectionality thoroughly for a very long time.
There is also some history in the HTML Bidi requirements doc at this location
Also, note that the bug mentioned in the start of this issue has to do with how the Unicode Bidi Algorithm works with numbers (numbers are not strongly directional).
If you have a negative number (-1.7
say), the display of the minus sign will be incorrect if it is not prefixed with a character such as the ALM (U+061C) or LRM (U+200E). Some I18N libraries such as ICU4J, produce ALM while Intl.NumberFormat
will produce LRM when formatting such a number. If no prefixing is done, the results can have the minus sign "swing around" to the other side depending on the direction. dir=auto
isn't magic... sometimes UBA needs more help.
from html.
My first instinct was to feel that the "new" behavior (in the spec for the past decade, but not actually implemented in browsers until the recent Chrome change) would be preferable, but I'm not sure it's worth the potential compat issues of changing something that's been established on the web for so many years.
I don't believe there is any ideal algorithm or heuristic that can be relied on to automatically give the desired result in all cases; whatever we do, added "hints" in the form of bidi control characters and/or properties will sometimes be needed. Given this, stability should probably trump the possibly-marginal benefits of the change.
So +1 to @annevk, I think.
from html.
This is a complicated area. The expected behaviour for numbers and punctuation varies according to what punctuation marks are involved, whether and what characters precede the expression, and what language this is. See https://r12a.github.io/scripts/arab/arb.html#expressions
For example, if this was a sentence capturing data related to 'Change in flow rate' (written in Arabic), and it was provided with the value written in memory as '100‐200' (ie. an increase) using ‐ U+2010 HYPHEN as the separator (which is appropriate), you'd expect to see '200-100' rendered in an Arabic sentence (but '100-200' in a Hebrew sentence). Enter those values in the JS Fiddle and Chrome shows '200-100' (indicating an increase), but Firefox applies LTR direction and so you get '100-200', which in a true RTL context would indicate a decrease rather than an increase. (Note, that this behaviour is different from what you get when using - U+002D HYPHEN-MINUS.)
So that's at least one example that counters the one using the negative sign, but i expect that working out all the possible scenarios and effects is a little complicated, and i'm not sure what to recommend at the moment. It seems as if Chrome's approach might possibly be safer when working with data being dropped into inline text, but that's just a hunch at the moment.
On the other hand, if a telephone number or a MAC address string are dropped into an Arabic sentence, then applying LTR directionality would usually be recommended – you don't want the component parts moving around. I don't know whether there's a one-size-fits-all answer to the use case described (which ignores metadata that comes with the data inserted, or an expectation of what type of data the insertion is (eg. a MAC address), that can be used to set the dir attribute on the inline element).
Not sure that helps us get closer to an answer, but it may hopefully advise a little caution in drawing conclusions here.
from html.
Here's a quick test to show the range example. It gives different results in Firefox and Chrome, but Chrome is the one that's correct this time.
from html.
Related Issues (20)
- Ability to configure whether script elements should execute for setHTMLUnsafe()
- `html` end tag omission HOT 3
- Navigation: Clarification on `ever populated` flag of DocumentState during apply the history step HOT 3
- Upcoming WHATNOT meeting on 2/8/2024 HOT 2
- Navigation: DocumentState request referrer is not set for about:srcdoc
- `<callout>` element for callouts/alerts/admonitions HOT 35
- Proposal: HTML Attribute to state non-consent when scraping for training datasets HOT 1
- Can a task throw exceptions? HOT 2
- "run a classic script" returns completion records and throws HOT 1
- Session history step of top level navigable when child navigables traverse history HOT 1
- Should there be an opt-out for declarative shadow roots having `clonable=true`? HOT 27
- Should `<a target="_blank">` and `window.open` consume the transient activation? HOT 2
- `<img sizes="auto, 100px" loading="eager">`: `auto` equates to `100wv` but should ideally be ignored HOT 2
- Constrain OffscreenCanvas with a placeholder canvas element HOT 8
- A way to run code before the next frame HOT 8
- New attribute for avoiding to autocapitalize text input fields HOT 1
- Autocomplete attribute value to indicate form input is third-party data
- Improve API of `insertAdjacent*()` methods HOT 2
- Why does popover hide when the popover attribute changed HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html.