Re: [csswg-drafts] [selectors] pseudo selector to match forms ValidityState (#1525)

@AutoSponge:

> > The pseudo-classes don't have any effect on the accessibility tree. They are only used to match form fields that are in a specific invalid state.
> 
> I didn't explain it well. It needs to have an effect or it won't work. Best practice is to currently render an input with the error message related by `aria-describedby`. This does not change that. And when someone tries to use it, it will have a worse outcome. Placing several errors together, rendered but hidden, will all read out. JS is still needed to do the connections dynamically for AT.

So if I understand you correctly, you mean the given use case of exposing the correct error message related to a specific validity state should have an effect on the AT, correct?

Then I'd argue that this should rather be an ARIA feature, meaning it should be possible to associate an error message with the right validity state directly within HTML. How exactly that's achieved needs to be discussed. Mind [filing an issue in the ARIA repo](https://github.com/w3c/aria/issues/new?template=normative-change.md) to discuss that? Related resources seem to be https://www.w3.org/WAI/ARIA/track/issues/651 and https://github.com/w3c/aria/issues/2048.
Though I still believe it's valuable to also expose the validity state to CSS via the resolved on pseudo-class extensions, as they allow authors to style things differently based on that state and they are not restricted to the given use case. Both features should go hand in hand, though.

Sebastian

-- 
GitHub Notification of comment by SebastianZ
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1525#issuecomment-4097249384 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 20 March 2026 10:59:55 UTC