I'm trying to implement an input with the autofocus
attribute, it is working when I'm using it alone, but when I add an IonButton it's not working.
This is my code, I removed all of the unnecessary code to simplify the question:
import { IonContent, IonPage, IonInput, IonButton } from '@ionic/react';
import React from 'react';
const Home: React.FC = () => {
return (
<IonPage>
<IonContent fullscreen>
<IonInput autofocus></IonInput>
<IonButton size="default" className="btn center" type="submit">
Login
</IonButton>
</IonContent>
</IonPage>
);
};
export default Home;
Why is that?, the button needs to be of type submit
because it's inside a form
Edit
I also tried with <input type="submit">
and it worked, but it also fails with <input type="button">
and I would like to use it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…