-
Notifications
You must be signed in to change notification settings - Fork 693
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
[selectors-4] and a11y: pseudo-elements for ::label, ::description, ::active-descendent, etc. #6719
Comments
Similar proposals for this usecase:
|
Ah, yes, I see the need has come up before, and been deferred. I think my proposal goes farther, because it includes anything that acts as a label (including those that have mainly been for AT), not just I also think the pseudo-element approach works well for selecting the actual elements (and perhaps their descendants), rather than just inserting pseudo-classes for that element into a function. I also like that this approach is more generally extendable to other aria attributes/properties, like those I mentioned. |
APA supports the continued refinement of this idea. It solves a problem for developers. |
HTML has a new concept of linked elements, so it might be worth considering including popovers in the proposed pseudo-elements. |
Right, that is a good example of one html element referencing another, as these aria mechanisms do, with no good way to select through that reference. Maybe something like |
It is sometimes difficult to select the right corresponding element that has a significant relationship to another element, if the two elements do not appear in an order that allows the styling of one to be based on the state of the other.
For instance, if author want to style a label based on the validity of an input, they could do something like this:
...but that only works if the label is after the input, because there is no parent selector or previous sibling selector. However, the UA should know after the parsing the html and before the styling assignment which label is associated with which input, whether through
for
oraria-labeledby
, or by being the parent of the input, or some other mechanism. So I am proposing that the following would work to select that label (or element acting as a label for the input):So,
::label
is a pseudo-element that selects the labeling element, wherever it exists in the DOM, for the element the pseudo is attached to.This
::label
pseudo could also select certain of label-like elements with the proper defined relationships, such as a<th>
that "labels" a<td>
.Similarly,
::description
would select the element that the subject wasaria-describedby
, and::active-descendent
would select the validaria-activedescendent
of the subject (which might not be a DOM descendent, thanks toaria-owns
).The text was updated successfully, but these errors were encountered: