Jeremy Keith takes us through his thought process regarding the choice of link or
button when planning accessible interactive disclosure elements.
button is generally a solid choice as it’s built for general interactivity and carries the expectation that when activated, something happens. However in some cases a link might be appropriate, for example:
- when the target should automatically receive focus;
- when the trigger and target content are relatively far apart in the DOM; and/or
- when the revealed content feels like a “new page”.
In the case of a progressively-enhanced modal dialogue, for example, all of the above might be true.
In such cases you might choose to use a link with a fragment identifier (