Merge pull request #31347 from backstage/revert-bui-button-fix

Revert "Merge pull request #31230 from backstage/bui-fix-tooltip"
This commit is contained in:
Charles de Dreuille
2025-10-07 16:50:49 +01:00
committed by GitHub
3 changed files with 2 additions and 29 deletions
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/ui': patch
---
Enable tooltips on disabled buttons with automatic wrapper
@@ -19,7 +19,6 @@ import { Button } from './Button';
import { Flex } from '../Flex';
import { Text } from '../Text';
import { Icon } from '../Icon';
import { Tooltip, TooltipTrigger } from '../Tooltip';
const meta = {
title: 'Backstage UI/Button',
@@ -217,12 +216,3 @@ export const Playground: Story = {
</Flex>
),
};
export const DisabledWithTooltips: Story = {
render: () => (
<TooltipTrigger>
<Button isDisabled>Save</Button>
<Tooltip>Why this is disabled</Tooltip>
</TooltipTrigger>
),
};
+2 -14
View File
@@ -16,7 +16,7 @@
import clsx from 'clsx';
import { forwardRef, Ref } from 'react';
import { Button as RAButton, Focusable } from 'react-aria-components';
import { Button as RAButton } from 'react-aria-components';
import type { ButtonProps } from './types';
import { useStyles } from '../../hooks/useStyles';
@@ -30,7 +30,6 @@ export const Button = forwardRef(
iconEnd,
children,
className,
isDisabled,
...rest
} = props;
@@ -39,29 +38,18 @@ export const Button = forwardRef(
variant,
});
const btn = (
return (
<RAButton
className={clsx(classNames.root, className)}
ref={ref}
{...dataAttributes}
{...rest}
isDisabled={!!isDisabled}
>
{iconStart}
{children}
{iconEnd}
</RAButton>
);
return isDisabled ? (
<Focusable>
<span role="button" tabIndex={0} style={{ display: 'inline-flex' }}>
{btn}
</span>
</Focusable>
) : (
btn
);
},
);