@@ -21,7 +21,6 @@ function EndpointUrl({ url }: { url: string }) {
2121 hintKey = "api.copyUrlHint"
2222 copiedKey = "api.urlCopied"
2323 className = "api-endpoint-url-btn"
24- as = "button"
2524 >
2625 < code className = "api-code api-code-inline api-endpoint-url" > { url } </ code >
2726 </ CopyOnClickTip >
@@ -33,15 +32,12 @@ function CopyOnClickTip({
3332 hintKey,
3433 copiedKey,
3534 className,
36- as = "button" ,
3735 children,
3836} : {
3937 text : string ;
4038 hintKey : "api.copyUrlHint" | "api.copyExampleHint" ;
4139 copiedKey : "api.urlCopied" | "api.exampleCopied" ;
4240 className : string ;
43- /** `div` for flow children like <pre> (invalid inside <button>). */
44- as ?: "button" | "div" ;
4541 children : ReactNode ;
4642} ) {
4743 const { t } = useI18n ( ) ;
@@ -127,26 +123,11 @@ function CopyOnClickTip({
127123 } ,
128124 onKeyDown : ( event : { key : string ; preventDefault : ( ) => void } ) => {
129125 if ( event . key === "Escape" ) closeTip ( ) ;
130- if ( as === "div" && ( event . key === "Enter" || event . key === " " ) ) {
131- event . preventDefault ( ) ;
132- void copyText ( ) ;
133- }
134126 } ,
135127 "aria-label" : t ( hintKey ) ,
136128 "aria-describedby" : showTip ? tipId : undefined ,
137129 } ;
138130
139- if ( as === "div" ) {
140- return (
141- < >
142- < div { ...shared } role = "button" tabIndex = { 0 } >
143- { children }
144- </ div >
145- { tip }
146- </ >
147- ) ;
148- }
149-
150131 return (
151132 < >
152133 < button type = "button" { ...shared } >
@@ -164,9 +145,8 @@ function CopyableExample({ text }: { text: string }) {
164145 hintKey = "api.copyExampleHint"
165146 copiedKey = "api.exampleCopied"
166147 className = "api-example-copy-btn"
167- as = "div"
168148 >
169- < pre className = "api-code api-example-pre" > { text } </ pre >
149+ < code className = "api-code api-example-pre" > { text } </ code >
170150 </ CopyOnClickTip >
171151 ) ;
172152}
0 commit comments