altcha-widget configuration floating UI does not recognize floating property
Closed this issue · 4 comments
Hi! I am using the following script to embed the altcha-widget on my website:
<altcha-widget
challengeurl="{https://eu.altcha.org/api/v1/challenge?apiKey=ckey_myapikey}"
auto = "onload"
hidelogo
hidefooter
floating
></altcha-widget>
and it seems that the floating property is not recognized. The error message I get is this:
Type '{ challengeurl: string; auto: "onload"; hidelogo: true; hidefooter: true; floating: true; }' is not assignable to type 'Partial<Configure & DOMAttributes & { children: any; }>'.
Property 'floating' does not exist on type 'Partial<Configure & DOMAttributes & { children: any; }>'.
I am trying use 'altcha' within a react js app, so I npm installed altcha and I use import 'altcha';
Maybe data-floating is the right property instead of floating? That did not throw errors but also did not make the captcha invisible.
Thanks for your help in advance.
If I add error typechecking using: {...({} as any)} via,
<altcha-widget
challengeurl="{https://eu.altcha.org/api/v1/challenge?apiKey=ckey_myapikey}"
auto = "onload"
hidelogo
hidefooter
floating
{...({} as any)}
>
then the error disappears and the captcha seems to be invisible. I just need your reassurance that floating is actually a property.
Hi, the floating property exist on the widget, what you're describing are issues with typings in React. Please also note that the floating UI is meant to be used inside <form>
element with a proper <button type="submit">
as the widget attaches to the button.
You can add the following declarations to declarations.d.ts
to have properly defined types:
declare namespace JSX {
interface IntrinsicElements {
"altcha-widget": AltchaAttrs;
}
interface AltchaAttrs {
auto: string;
challengeurl: string;
floating: boolean;
hidelogo: boolean;
hidefooter: boolean;
}
}
The JSX typings are now implemented in the latest version 0.6.4
so it should work out of the box without the need to add your declarations.
Much appreciated thank you! Works great.