-
-
Notifications
You must be signed in to change notification settings - Fork 850
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
Disabled <sl-button> allows execution of href #2151
Comments
This could be fixed by updating the docs, as links weren't intended to be disabled and can't be (at least per spec). But if you prefer to have a disable link behavior, we should probably do what @ankitmhn proposed in #2157 to revert the link to a button. @lindsaym-fa it's your call — which way do you want to go with this one? :) Disclaimer: I haven't looked into the pros and cons of disabling a link (or reverting a tag which might be unexpected) from an accessibility perspective. |
FWIW I already updated the WA docs to say disabled links aren't supported so, as a note to myself, I'll need to update that to match whatever we decide here. |
Just gonna drop this nugget here: https://www.scottohara.me/blog/2021/05/28/disabled-links.html we could leave the link, and never render the href on the underlying |
🤔
|
Given My biggest concern here is meeting end user expectations: users (except those with screen readers or the like) don't know when a button is a button or a link, but they would expect a disabled element to be inert. Helping devs learn that disabled link buttons aren't supported is key. Preventing it from getting to end users would be icing on the cake. |
#2157 is definitely an interesting alternative — we avoid subverting end user expectations and we might better meet developer expectations. The potential consequences aren't clear to me, but it seems worth looking into, imo. ETA: Folks using assistive tech wouldn't have any way to perceive, let alone get to, a disabled button, right? I'd guess that changing the tag shouldn't have any ill effect re:accessibility, but maybe I'm missing something. |
That was my reasoning for reverting the tag - we don't affect the accessibility while at the same time the dev experience is met. Maybe we could update the docs to indicate that a disabled link button is rendered as a disabled ? |
Describe the bug
When
sl-button
has anhref
and isdisabled
, activating the button still executes thehref
.To Reproduce
Steps to reproduce the behavior:
href
anddisabled
attributes, e.g.<sl-button href="https://shoelace.style" disabled>Linked Button</sl-button>
href
is executedDemo
https://codepen.io/omnifides/pen/xxozBab
Browser / OS
The text was updated successfully, but these errors were encountered: