Is there a way to change the functioning of "tab" key for text input?

My usecase for now is getting text input from the user, similar to what is shown to the person (like the screenshot below)

The issue is that when “tab” key is pressed, the focus gets changed from the text box - instead of the ideal function of inserting a tab. Is there a way this can be achieved?

Happy to explain more on the usecase if needed.