Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Button issue with Formik #99

Closed
oddjones opened this issue Jan 7, 2021 · 13 comments · Fixed by #110
Closed

Button issue with Formik #99

oddjones opened this issue Jan 7, 2021 · 13 comments · Fixed by #110
Labels
bug Something isn't working severity: minor

Comments

@oddjones
Copy link

oddjones commented Jan 7, 2021

Hi there - I've noticed in the Formik example (and in a different Formik example I've been asked to review) that there's a recurrent Cannot read property 'addEventListener' of null at e.init (button.js:718) error being pumped into the console - I've been having the devil's own job chasing it down - has anybody there figured out what's causing it?

@andymantell
Copy link
Collaborator

ah, when you press the submit button?

@oddjones
Copy link
Author

oddjones commented Jan 7, 2021

yep - although I'm making things hard for myself by trying to implement it in NextJS and I'm having it happen when I interact with any field on the form (works fine if I just use a regular button)

@andymantell
Copy link
Collaborator

I can reproduce the issue in the Formik and React-hook-form examples here:

https://surevine.github.io/govuk-react-jsx-examples/

I'm in the middle of something for a second, but I'll try and take a look at the end of today.

Does the button "work" apart from this? Or are you totally blocked from doing what you're doing?

@oddjones
Copy link
Author

oddjones commented Jan 7, 2021

Ah mate - seriously - it's just bugging me ;-) The button does seem to work - but because my example uses NextJS it's way more shouty about the error (no console there - right up in your face) - it can wait - no rush at all

@andymantell
Copy link
Collaborator

ok that's good, so long as you can do what you need to do for the moment.

Thanks for raising it - I'll sort it out as soon as I can.

@andymantell
Copy link
Collaborator

I think this might be the answer:

https://stackoverflow.com/a/63033314

@oddjones
Copy link
Author

oddjones commented Jan 7, 2021 via email

@andymantell
Copy link
Collaborator

sorry that was sort of a note to myself. It's the way that I'm initialising the govuk-frontend button javascript inside my component. It's not something you can fix at your end...

@oddjones
Copy link
Author

oddjones commented Jan 7, 2021

smiles<<

@andymantell
Copy link
Collaborator

@oddjones and @SamChatfield - I think I have a simple fix for this. So simple I am suspicious of it, but I'm hoping it's a goer.

I'm gonna pursue it this weekend and extend my pipeline to publish release candidates so that you can both test it out before I let it out into the wild...

@oddjones
Copy link
Author

oddjones commented Mar 12, 2021 via email

@andymantell
Copy link
Collaborator

@oddjones I've published as a release candidate so you can give it a whirl. If you wouldn't mind doing npm install govuk-react-jsx@next and seeing how that goes that would be great. Thanks!

@andymantell
Copy link
Collaborator

@oddjones This has been released now as https://github.com/surevine/govuk-react-jsx/releases/tag/v5.1.0

Please let me know if you have any further issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working severity: minor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants