Skip to content

Commit 7adde46

Browse files
committed
fix: disociate p and span
1 parent 8b7e9ef commit 7adde46

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codegouvfr/react-dsfr",
3-
"version": "1.23.10-rc.1",
3+
"version": "1.23.10-rc.2",
44
"description": "French State Design System React integration library",
55
"repository": {
66
"type": "git",

src/Tag.tsx

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -176,24 +176,38 @@ export const Tag = memo(
176176
{children}
177177
</button>
178178
)}
179-
{linkProps === undefined &&
180-
nativeButtonProps === undefined &&
181-
(AsTag === "span" || AsTag === "p") && (
182-
<AsTag
183-
{...nativeParagraphOrSpanProps}
184-
id={id_props ?? nativeParagraphOrSpanProps?.id ?? id}
185-
className={cx(nativeParagraphOrSpanProps?.className, className)}
186-
style={{
187-
...nativeParagraphOrSpanProps?.style,
188-
...style
189-
}}
190-
title={title ?? nativeParagraphOrSpanProps?.title}
191-
ref={ref as React.ForwardedRef<HTMLParagraphElement>}
192-
{...rest}
193-
>
194-
{children}
195-
</AsTag>
196-
)}
179+
{linkProps === undefined && nativeButtonProps === undefined && AsTag === "p" && (
180+
<p
181+
{...nativeParagraphOrSpanProps}
182+
id={id_props ?? nativeParagraphOrSpanProps?.id ?? id}
183+
className={cx(nativeParagraphOrSpanProps?.className, className)}
184+
style={{
185+
...nativeParagraphOrSpanProps?.style,
186+
...style
187+
}}
188+
title={title ?? nativeParagraphOrSpanProps?.title}
189+
ref={ref as React.ForwardedRef<HTMLParagraphElement>}
190+
{...rest}
191+
>
192+
{children}
193+
</p>
194+
)}
195+
{linkProps === undefined && nativeButtonProps === undefined && AsTag === "span" && (
196+
<span
197+
{...nativeParagraphOrSpanProps}
198+
id={id_props ?? nativeParagraphOrSpanProps?.id ?? id}
199+
className={cx(nativeParagraphOrSpanProps?.className, className)}
200+
style={{
201+
...nativeParagraphOrSpanProps?.style,
202+
...style
203+
}}
204+
title={title ?? nativeParagraphOrSpanProps?.title}
205+
ref={ref as React.ForwardedRef<HTMLSpanElement>}
206+
{...rest}
207+
>
208+
{children}
209+
</span>
210+
)}
197211
</>
198212
);
199213
})

0 commit comments

Comments
 (0)