Open Bug 1169986 Opened 9 years ago Updated 2 years ago

Text from attributes with dir="auto" should be displayed in the direction of the attribute, not the element

Categories

(Core :: Layout: Text and Fonts, defect)

defect

Tracking

()

Tracking Status
firefox41 --- affected

People

(Reporter: smontagu, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: rtl)

Attachments

(3 files)

HTML5 made a change in https://www.w3.org/Bugs/Public/show_bug.cgi?id=17829 to specify that "Text from attributes [that is exposed in user interfaces] is expected to be rendered in a manner that honours the directionality of the attribute.", instead of the directionality of the element as previously.

This makes a practical difference in the case of elements with dir="auto", where the directionality of the element is determined by its content, but the directionality of the attribute is determined independently by *its* own content.

So something like data:text/html; charset=utf-8,<p dir="auto" title="Hello!">مرحبا!</p> should be displayed with the exclamation mark on the left of the Arabic text in the body, but on the right of the English text in the tooltip. 

All the other attributes listed at https://html.spec.whatwg.org/multipage/dom.html#directionality-capable-attribute are also potentially affected.
This turned out a little bit more than the one-line patch I thought it would be.
Assignee: nobody → smontagu
Attachment #8633468 - Flags: review?(jfkthame)
Attached file Testcase
I doubt if there's any way to auto-test this.
Other directionality-capable attributes:

abbr on th elements
content on meta elements -- AFAICT we don't render these anywhere

alt on area, img, and input elements
label on menuitem, menu, optgroup, option, and track elements
placeholder on input and textarea elements -- all these will require some special casing in DirectionalityUtils.cpp and/or html.css (in the case of alt on img this is better than calling BidiLevelFromStyle in nsImageFrame as I suggested on IRC, because we need to know the resolved direction before rendering the text so as to align it correctly)
Summary: Text from attributes should be displayed in the direction of the attribute, not the element → Text from attributes with dir="auto" should be displayed in the direction of the attribute, not the element
Blocks: 1134925
Blocks: 716614
This is probably the simplest patch in the series, and also the most requested per dependencies

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: smontagu → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: