Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit with enter-press is not working if datepicker is inside form tag #57

Open
marcoschulte opened this issue Aug 26, 2021 · 3 comments
Labels
question Further information is requested

Comments

@marcoschulte
Copy link

marcoschulte commented Aug 26, 2021

Hi icehaunter,

great work on this component! However, I noticed an issue with this component. If it is being placed inside a form, it is not possible anymore to submit the form with a press of enter.

<form v-on:submit.prevent="save">
   <datepicker v-model="foo"/>
   <input type="text" v-model="bar">
   <button type="submit">Speichern</button>
</form>

This form can only be submitted by pressing the button. However, if I move the datepicker component above the opening form tag, I can submit the form if the text input is focused and I press enter.

@icehaunter
Copy link
Owner

Hello! I'm not sure how you want this to be handled, given that the input is readonly by default, and clicking enter just closes the picker. Would you like a onEnter event to listen to?

@icehaunter icehaunter added the question Further information is requested label Jun 4, 2023
@Laripoli
Copy link

Hey, the problem is that if the datepicker component is present inside a form tag, the rest of inputs no longer react to enter keypress, as a workaround I set a ref for the form and add @keyup.enter="formEl!.requestSubmit()" to the form, losing the enter event of the component but at least keeping the submit on enter key for the rest of the form.

@marcoschulte
Copy link
Author

Sorry, my issue description wasn't clear enough. As @Laripoli says, the issue is not if the datepicker is opened. The issue is that I cannot submit the form with enter if the input=text control is focused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants