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

Target attribute not supported on <form> with use:enhance #375

Closed
McAndze opened this issue Mar 5, 2024 · 2 comments
Closed

Target attribute not supported on <form> with use:enhance #375

McAndze opened this issue Mar 5, 2024 · 2 comments
Labels
bug Something isn't working question Further information is requested

Comments

@McAndze
Copy link

McAndze commented Mar 5, 2024

Hi, thank you for this cool tool. I'd like to use it in a widget that's embedded in an iFrame. In this case, I want the redirect to target _top such that the top window container is what navigates when receiving the redirect.

I was unable to find anything regarding the expected behaviour here, so forgive me if this should be more of a feature request than a bug.

Description
When using use:enhance, the target attribute of the <form> is not respected. This makes the behaviour different to non-JS users.

If applicable, a MRE
I have modified the tutorial example a bit to throw a redirect and set a target="_blank" on the <form>. No matter what you set the target to, the redirect will be opened inside the preview. When removing use:enhance, the redirect opens in a new tab as expected.

https://stackblitz.com/edit/sveltekit-superforms-1-tutorial-15p547?file=src%2Froutes%2F%2Bpage.svelte

I realize I could probably tap into something like onResult and achieve this behaviour, but it seems generally desirable to use the same behaviour as the non-enhanced redirect behaviour.

@McAndze McAndze added the bug Something isn't working label Mar 5, 2024
@ciscoheat
Copy link
Owner

Hi, glad you like Superforms! Can you check if this is a more general SvelteKit issue by swapping the use:enhance for the SvelteKit built-in version?

Also, since Superforms 2 is available I don't have much time to add features to version 1, so please use this as a template instead: https://stackblitz.com/edit/superforms-2-testing?file=src%2Froutes%2F%2Bpage.server.ts,src%2Froutes%2F%2Bpage.svelte

@ciscoheat ciscoheat added the question Further information is requested label Mar 6, 2024
@ciscoheat
Copy link
Owner

Closing, as this seems to be a SvelteKit issue (as it doesn't work with the built-in enhance as well). An issue is opened here: sveltejs/kit#11931

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

No branches or pull requests

2 participants