An open source design system that's fully customizable and agent ready
TypeScript
fix(Citation): prevent rest spread from overriding accessibility props (#2217)
Cindy Zhang83a05b26412f
diff --git a/packages/core/src/Citation/XDSCitation.tsx b/packages/core/src/Citation/XDSCitation.tsxindex d40ddf6933..3ad5b24ab2 100644--- a/packages/core/src/Citation/XDSCitation.tsx+++ b/packages/core/src/Citation/XDSCitation.tsx@@ -149,7 +149,12 @@ export function XDSCitation({const icon = source.icon;const Tag = href ? 'a' : 'span';const linkProps = href- ? {href, target: '_blank' as const, rel: 'noopener noreferrer' as const, title}+ ? {+ href,+ target: '_blank' as const,+ rel: 'noopener noreferrer' as const,+ title,+ }: {title};// Both <a> and <span> extend HTMLElement — narrow via intersection@@ -159,15 +164,19 @@ export function XDSCitation({if (variant === 'number') {return (<Tag+ {...rest}ref={elementRef}role="doc-noteref"aria-label={`Citation ${number}: ${title}`}data-testid={testId}{...linkProps}- {...rest}{...mergeProps(xdsClassName('citation', {variant}),- stylex.props(styles.number, href != null && styles.numberHover, xstyle),+ stylex.props(+ styles.number,+ href != null && styles.numberHover,+ xstyle,+ ),className,style,)}>@@ -178,12 +187,12 @@ export function XDSCitation({return (<Tag+ {...rest}ref={elementRef}role="doc-noteref"aria-label={`Citation ${number}: ${title}`}data-testid={testId}{...linkProps}- {...rest}{...mergeProps(xdsClassName('citation', {variant}),stylex.props(diff --git a/packages/core/src/Citation/index.ts b/packages/core/src/Citation/index.tsindex 2365885bca..a6babb0e86 100644--- a/packages/core/src/Citation/index.ts+++ b/packages/core/src/Citation/index.ts@@ -2,5 +2,12 @@'use client';+/**+ * @file index.ts+ * @input Imports XDSCitation component and types from XDSCitation.tsx+ * @output Exports XDSCitation, XDSCitationProps, XDSCitationSource+ * @position Component entry point; re-exported by /packages/core/src/index.ts+ */+export {XDSCitation} from './XDSCitation';export type {XDSCitationProps, XDSCitationSource} from './XDSCitation';