You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs recommend using event.preventDefault() directly in event handler code. When doing so, the generated Qwik component uses preventDefault() in a QRL-wrapped (ie async) function, which doesn't work
functionhandleSubmit(event: SubmitEvent){event.preventDefault();// ... rest of the handler}return(<formonSubmit={(event)=>handleSubmit(event)}>{/* ... */}</form>);```You would modify the Qwik component's template to include the declarative attribute:```html<formpreventdefault:submitonSubmit$={(event)=>handleSubmit(event)}>{/* ... */}</form>AndthehandleSubmitfunctionwouldnolongerneedtheevent.preventDefault()call:
functionhandleSubmit(event: SubmitEvent){// ... rest of the handler,}
I am interested in helping provide a fix!
Yes
Which generators are impacted?
Reproduction case
https://mitosis.builder.io/playground/?code=KYDwDg9gTgLgBAE2AMwIYFcA29noHYDGMAlhHnALICeAwhALaR7B4wAUAlHAN4BQccXIRJk4AC1R4EmYAGV0AI3rF2wAG4sYALjjylKgKIbWXPgIHrNAOjBRLrACIoM2TgG5e%2FcwTIBnHND0cAC8cPYwVjCoUADmwPCovnAAEgAqFAAyAGKBBjL0mh7mcMTIcGwAhMiBVgRiwAQA1gBqqJjECCpUnKZexW3AsGwA5DlQQcRJxHhqbR3DHEXFcHYw6FB4SwIAvn1wPnj%2BiKhRIXDMAO5wY%2FQOJ6hs1eOLewdHwPSoxJhnCPdWcXYww%2BX0wCy2%2Bz8EBkVkwEBibBB3xeO08AlW63IbD2AB4nkEyHplDBgtxEcYYFxggA%2BcSSaRyRTE8maDjbal7AQ46ZgdDwGBUMDAYIAIiRmBF51QBVF4sldgAjuhiHYEHAAPQc5ZwHEKPkwUQCoWi3xMlQi6lElQ49V6mAGvBa8w2%2FFOl7bIA%3D%3D%3D
Expected Behaviour
Multi-framework support for
preventDefault()
Actual Behaviour
The docs recommend using
event.preventDefault()
directly in event handler code. When doing so, the generated Qwik component usespreventDefault()
in a QRL-wrapped (ie async) function, which doesn't workAdditional Information
This example is taken directly from the docs:
https://mitosis.builder.io/docs/using-libraries/#focus-on-web-fundamentals
It seems to be the only mention of
preventDefault()
anywhere in the docsThe text was updated successfully, but these errors were encountered: