chore: fix up code review comments

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-07-13 11:30:50 +02:00
parent ae746946f7
commit 9386402764
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
---
'@backstage/core-components': minor
'@backstage/core-components': patch
---
Improve accessibility for CopyTextButton
@@ -44,6 +44,6 @@ export const LongerTooltipDelay = () => (
export const WithAriaLabel = () => (
<CopyTextButton
text="The text to copy to clipboard"
ariaLabel="This is an aria label"
aria-label="This is an aria label"
/>
);
@@ -104,7 +104,7 @@ describe('<CopyTextButton />', () => {
it('aria-label', async () => {
const { getByLabelText } = await renderInTestApp(
<TestApiProvider apis={apis}>
<CopyTextButton {...props} ariaLabel="text for aria-label" />
<CopyTextButton {...props} aria-label="text for aria-label" />
</TestApiProvider>,
);
expect(getByLabelText('text for aria-label')).toBeInTheDocument();
@@ -50,7 +50,7 @@ export interface CopyTextButtonProps {
}
type LabelledCopyTextButtonProps = CopyTextButtonProps & {
ariaLabel?: string;
'aria-label'?: string;
};
/**
@@ -69,7 +69,7 @@ type LabelledCopyTextButtonProps = CopyTextButtonProps & {
* ```
* <CopyTextButton
* text="My text that I want to be copied to the clipboard"
* ariaLabel="Accessible label for this button" />
* arial-label="Accessible label for this button" />
* ```
*/
export function CopyTextButton(props: LabelledCopyTextButtonProps) {
@@ -77,7 +77,7 @@ export function CopyTextButton(props: LabelledCopyTextButtonProps) {
text,
tooltipDelay = 1000,
tooltipText = 'Text copied to clipboard',
ariaLabel = 'Copy text',
'aria-label': ariaLabel = 'Copy text',
} = props;
const errorApi = useApi(errorApiRef);
const [open, setOpen] = useState(false);