Using <button>
elements for accessibility
#558
Replies: 2 comments 4 replies
-
A design goal of Unpoly is to progressively enhance HTML. So we shy away from adding features that can have no graceful degradation when no JavaScript is available. An If you absolutely want to use buttons, it might work with |
Beta Was this translation helpful? Give feedback.
-
You could try assigning the button to a different form. Sometimes I'll just set the |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm new to unpoly. It looks like interactive elements are always
<a>
? (Except for submitting forms).Does unpoly support
<button>
for replacing page content? I want to be sure my projects meet common accessibility guidelines, which means actual buttons for some things, especially actions where the address bar URL doesn't change. (source, source, source).How does unpoly handle this? Checking the unpoly demo, it looks like everything is
<a>
, with no aria roles or other accessibility annotations.I could do
<form><button></form>
, but forms aren't allowed to be nested, so that doesn't work for some situations.I could do `<a role="button>", but that only partially covers the gap on accessibility (source).
I could connect a button to an unpoly compiler and call the JS API to do all the same things I'd normally do with
up-*
attributes, but that feels clumsy, especially given how frequently<button>
is the right choice.How do folks handle this?
Beta Was this translation helpful? Give feedback.
All reactions