Skip to content

Commit 460e447

Browse files
author
WB01676250
committed
fix: typography
1 parent c29e7bf commit 460e447

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/typography/Base/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,6 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
426426
renderOperations(canEllipsis),
427427
];
428428

429-
// https://github.com/ant-design/ant-design/issues/54265
430-
const mergedComponent = component === 'a' && disabled ? 'span' : component;
431-
432429
return (
433430
<ResizeObserver onResize={onResize} disabled={!mergedEnableEllipsis}>
434431
{(resizeRef: React.RefObject<HTMLElement>) => (
@@ -453,7 +450,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
453450
...style,
454451
WebkitLineClamp: cssLineClamp ? rows : undefined,
455452
}}
456-
component={mergedComponent}
453+
component={component}
457454
ref={composeRef(resizeRef, typographyRef, ref)}
458455
direction={direction}
459456
onClick={triggerType.includes('text') ? onEditClick : undefined}

components/typography/Link.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ const Link = React.forwardRef<HTMLElement, LinkProps>(({ ellipsis, rel, ...restP
2222
rel: rel === undefined && restProps.target === '_blank' ? 'noopener noreferrer' : rel,
2323
};
2424

25+
// https://github.com/ant-design/ant-design/issues/54265
26+
const component = restProps.disabled ? ('span' as const) : restProps.component || ('a' as const);
27+
2528
// @ts-expect-error: https://github.com/ant-design/ant-design/issues/26622
2629
delete mergedProps.navigate;
2730

28-
return <Base {...mergedProps} ref={ref} ellipsis={!!ellipsis} component="a" />;
31+
return <Base {...mergedProps} ref={ref} ellipsis={!!ellipsis} component={component} />;
2932
});
3033

3134
export default Link;

0 commit comments

Comments
 (0)