If the answer by @Artur is not working, there's something you're missing in your approach. Here are more tips on implementation:
- Once you have the Button as the parent and the InputField set as the child, methodically inspect every component of your InputField game object and all its children for components that have a raycast target option. They should all be set to false.
- Also, if a "Caret" game object is created at play time you need to set its raycast target to false.
- I have a function that runs on that parent button press that sets all the necessary raycast targets to true (to allow interactability), and then a function that runs on deselect of input field that sets all those affected raycast targets back to false.
If you follow those tips you should have the functionality that Unity should have implemented from the beginning!