w3ctag / gaps

What are the big unmet user needs of the web platform?
1 stars 1 forks source link

IDREF attributes are fragile and painful to use #2

Open LeaVerou opened 3 months ago

LeaVerou commented 3 months ago

(An earlier version of this was posted in https://github.com/whatwg/html/issues/10143)

Pain points

Many HTML attributes need to reference one or more HTML elements in the document. This includes:

Currently, the only way to specify such references is to give these elements ids (if they don't already have them) and use these ids to link to them in these attributes.

This is problematic in several ways:

This is a very common author pain point around ARIA, and authors are pretty vocal about it: DX-related complaints were the 3rd biggest a11y complaint in the preliminary State of HTML results. It especially hurts a11y, since the effects of broken references in the a11y tree are not always obvious, and the more effort it takes to make HTML accessible, the less likely authors are to do it. While for <label> this is somewhat mitigated by the option to make the association implicitly by nesting the form control within the <label>, for the other cases there is no similar option. New features like popovers, invokers, or the anchor attribute exacerbate the problem further.

The IDL attributes for these are also inconsistent:

Potential solutions

Some considerations are: