-
Notifications
You must be signed in to change notification settings - Fork 86
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
Scale Link: Attribute "aria-disabled" stays "true" when link is not disabled anymore #1806
Comments
@georgwittberger-telekom-mms thank you for opening the issue, this should be fixed in the next release (beta.133) |
The attribute value changes as expected now but when the link is not disabled the attribute value is <a part="anchor" aria-disabled="undefined">...</a> This is not spec-compliant: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled The value of |
Hi @georgwittberger-telekom-mms, are you testing on the latest version? I am not seeing the issue on the latest version here https://telekom.github.io/scale/?path=/docs/components-link--standard |
This is not reproducible in Storybook because it renders a fresh version of the component every time you change props. In our project - currently on 3.0.0-beta.134 - it happens when a |
@georgwittberger-telekom-mms thanks for the feedback, I've made a simple https://codesandbox.io/s/scale-components-plain-html-template-forked-vzv595?file=/index.html sandbox to test this but still could not reproduce the bug. Are you using some framework to build your app ? (I also tested this on react and it seemed to work as expected) |
Hi @felix-ico , we are using React and the bindings you provide for it. I was able to find out how to reproduce the "undefined" issue. It occurs when you always pass the import { ScaleLink } from "@telekom/scale-components-react";
import React, { useState } from "react";
const Test: React.FC = () => {
const [disabled, setDisabled] = useState(false);
return (
<>
<button onClick={() => setDisabled(prevDisabled => !prevDisabled)}>
Toggle Disabled
</button>
<ScaleLink href="#" disabled={disabled || undefined}>
Test Link
</ScaleLink>
</>
);
}; This is what happens once you swap states: I suppose we should fix this on our side and make sure we always pass a boolean value to
|
Scale Version
3.0.0-beta.131
Framework and version
React 18.2.0 with @telekom/scale-components-react
Current Behavior
Once Scale Link has been disabled the attribute
aria-disabled="true"
persists on the inner<a>
element even when link is rendered withoutdisabled
later.Expected Behavior
When Scale Link is rendered without
disabled
attribute or withdisabled="false"
the attributearia-disabled="true"
is removed from the inner<a>
element or its value is set to"false"
.Code Reproduction
Initial HTML:
Then re-render
scale-link
element without attributedisabled
or withdisabled="false"
.Desktop:
Additional context
The problem seems to be on this line:
scale/packages/components/src/components/link/link.tsx
Line 68 in ba1ef8e
It seems like setting the value
false
inside thisprops
object does not remove the respective attribute once it has been rendered. Maybe consider changing this to:The text was updated successfully, but these errors were encountered: