Skip to content

Map the dir attribute with selectors the engine can parse - #650

Open
maurerdietmar wants to merge 1 commit into
DioxusLabs:mainfrom
maurerdietmar:dir-attribute
Open

Map the dir attribute with selectors the engine can parse#650
maurerdietmar wants to merge 1 commit into
DioxusLabs:mainfrom
maurerdietmar:dir-attribute

Conversation

@maurerdietmar

@maurerdietmar maurerdietmar commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

The bidi rules in the default stylesheet came from Gecko and match through its internal pseudo-classes (:-moz-dir-attr-rtl and friends), which the servo selector parser does not know. It dropped every one of them, so dir="rtl" set no direction and a page could not switch to right-to-left layout at all, even though the layout side fully supports it.

Use the attribute-selector form from the HTML spec's bidi rendering section instead. dir=auto keeps its isolation but not the content-based direction, which needs bidi analysis no selector can express.

WPT results

3 newly passing, 2 newly failing (net +1).

Full diff (5 changed tests)
+ Fail => Pass css/css-align/self-alignment/self-align-safe-unsafe-flex-003.html
+ Fail => Pass css/css-align/self-alignment/self-align-safe-unsafe-grid-003.html
+ Fail => Pass css/css-text/text-align/text-align-match-parent-01.html
- Pass => Fail css/css-text/text-align/text-align-match-parent-05.html
- Pass => Fail css/css-writing-modes/direction-upright-002.html

Generated by the WPT workflow.

The bidi rules in the default stylesheet came from Gecko and match
through its internal pseudo-classes (:-moz-dir-attr-rtl and
friends), which the servo selector parser does not know. It dropped
every one of them, so dir="rtl" set no direction and a page could
not switch to right-to-left layout at all, even though the layout
side fully supports it.

Use the attribute-selector form from the HTML spec's bidi rendering
section instead. dir=auto keeps its isolation but not the
content-based direction, which needs bidi analysis no selector can
express.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant