w3c / alreq

Documenting gaps and requirements for support of Arabic and Persian on the Web and in eBooks.
Other
60 stars 31 forks source link

:dir lacks wide support #256

Open r12a opened 1 year ago

r12a commented 1 year ago

This issue is applicable to all languages with RTL orthographies.

Style sheets need to add special rules for RTL styles if they are not supported by logical properties or values.

One approach is to create a second style sheet which, when pulled into an HTML page, overrides styles in the main style sheet with settings for RTL text. This approach is not ideal because it requires maintaining the styles in two separate locations, which can therefore get out of synch, and it requires explicit addition of a call to the second style sheet in every page that will support RTL text.

The :dir() pseudo-class avoids these issues by allowing the content author to include the RTL variations in the same style sheet as the others. However, it is not yet supported by all major browser engines.

A workaround that precedes selectors with :root[dir=rtl] selector_here can help, but :dir() is a better way forward. There also appear to be Shadow DOM implications if this is not supported.

The Gap:

:dir is not interoperably supported by all major browser engines.

selectors-4 Describes the :dir() feature in CSS. html5 Describes the :dir() feature in HTML.

Can I Use indicates that Gecko supports :dir(), but Blink, and Webkit do not. This was confirmed while trying to get this to work recently.

The functionality appears to be available in Blink, but behind a flag.

This simple test below checks whether :dir() causes styling to be changed. The test currently passes for Gecko, but not for Blink or WebKit browsers.

Priority:

This pseudo-class significantly improves the process of designing style sheets that can cater for both LTR and RTL pages. It is a valuable enabler for better internationalisation of the Web for the billion or so potential users of RTL scripts. This was therefore marked as Basic.

Tests & results:

interactive test, The browser supports :dir() selectors.

Action taken:

BlinkWebkit

Outcomes

WebKit now supports this selector, as well as Gecko.

r12a commented 1 year ago

The first comment in this issue contains text that will automatically appear in one or more gap-analysis documents as a subsection with the same title as this issue. Any edits made to that comment will be immediately available in the document. Proposals for changes or discussion of the content can be made in comments below this point.

Relevant gap analysis documents include: _AdlamArabic/PersianHebrewKashmiriN'KoUighur_

rniwa commented 1 year ago

See https://github.com/WebKit/WebKit/pull/3907

r12a commented 1 year ago

Thanks @rniwa! That's great news. Do we know when it will become available for released versions of the browser?

I'll update our test results and this gap report once it's available to general users.