-
Notifications
You must be signed in to change notification settings - Fork 27
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
:dir()
improved support
#177
Comments
@gsnedders Thanks! Is there a readme or guide (or video for that matter) to help find relevant tests like this? I have such a hard time navigating wpt.fyi sometimes, as much as I love the site and the value it adds. Thanks again! 🙏🏼 |
@brandonmcconnell I know wpt.fyi is very much a power user interface and there are plenty of things in hard-to-discover UI and documentation. If you have specific tasks you're trying to get done and can't, can you file an issue at https://github.com/web-platform-tests/wpt.fyi/issues? When it comes to finding tests, searching in a local checkout of https://github.com/web-platform-tests/wpt is probably most effective, since you can then search for the test contents, not just their names. |
@foolip That's very helpful— thanks! |
In the above case, I just started searching for "dir" and looked at where matched—that pseudo-classes (which are defined in Selectors) have tests in the Selectors directory isn't particularly surprising, given that knowledge about where they're specified. |
Better suggestion from @heycam and a lot faster
|
@karlcow @heycam Nice! I compiled that into a shell function I'll use when searching for tests from now on 👏🏼 function find-wpt-tests(){
cd "/path/to/wpt" # <-- replace with the path to the `wpt` directory on your local machine
grep -lR "$@" | grep -v "[-]ref.html$" | sed -e "s,^\.,https://wpt.fyi,"
}
# usage
find-wpt-tests ":dir(" |
I put together a slightly more sophisticated version of this function ☝🏼 which handles formatting flags for the returned results and some verbiage niceties:
I initially added all of that to this comment, but it became a bit too robust, so I created a separate repo for that that you can find here: find-wpt-tests |
There is also an open issue/pr about resolving these in shadow dom which would add a slew of tests when it lands web-platform-tests/wpt#29820 |
@bkardell Great find. Thanks, Brian! |
We do want to limit potential Inteorp 2023 tests to only include ones that don't fail because an unrelated technology is not supported. For example, if the test is for :dir() + foobar, and only passes if both are supported — and foobar is not supported in all the browser engine already, then it should not be part of Interop 2023. Why? Because foobar isn't part of Interop 2023. (Presuming it isn't). Engines should get scored according to their :dir() implementation, not on foobar. |
@jensimmons Fine point. I can see how those tests would likely be a better fit for a future shadow DOM rather than |
Also see web-platform-tests/wpt#25569 |
In the State of CSS 2022 question about browser incompatibilities, there were two mentions of |
In the MDN short survey on CSS & HTML, "CSS |
Some of the tentative tests here depend on whatwg/html#3699 / whatwg/html#7424. @meyerweb do you think that can be resolved soonish? |
Thank you for proposing We are pleased to let you know that this proposal was accepted as part of the CSS Pseudo-classes focus area. You can follow the progress of this Focus Area on the Interop 2023 dashboard. For an overview of our process, see the proposal selection summary. Thank you for contributing to Interop 2023! Posted on behalf of the Interop team. |
Description
"The
:dir()
pseudo-class in CSS allows elements to be selected based on the direction of the language, as determined in the HTML markup. There are really only two directions language can flow in a document, which are left-to-right and right-to-left. Think of this as a way to style elements that are distinguished by different language directionality."– @geoffgraham (via CSS Tricks)
I couldn't have explained it better, myself. Thanks, Geoff 🙏🏼
Rationale
:dir()
support is important to the effort of internationalization. This pseudo-class has been a long time coming and has been a topic of discussion for a while now as well:Formal (docs-style)
Informal
Directionality can currently be set in two primary ways— setting the HTML
dir
attribute to eitherltr
orrtl
, or setting thedirection
property in CSS to either of those same values.Elements explicitly setting
dir="rtl"
(or similar) can already be targeted with CSS using an attribute selector. However, this is usually an edge case, as that property is usually set once on a document, and does not necessarily apply that same directionality to all elements on the page.:dir()
is the solution here:[dir="rtl"]
(or similar)direction: rtl
(or similar)Specification
https://w3c.github.io/csswg-drafts/selectors-4/#the-dir-pseudo
Tests
More tests will likely be needed for this.
The text was updated successfully, but these errors were encountered: