Custom form - Error "An invalid form control with name='element' is not focusable"

Hey everyone,
I’m doing a custom form, depending on what you select, you have different fields. Everything is working how I want, I use .show() or .hide(). But the problem is, there are required elements that are in the hidden wrapper so the form can’t be sending.

I get this error for every hidden field:
An invalid form control with name='name' is not focusable

Do you have a solution for that?