Is there a way to recognise text fields?

I use many shortcuts with command, option, etc. however these are obviously the text selection navigators when inside a text box.

Is there a way to have a shortcut recognise if the highlighted UI element is a textbox, and if so, disable the shortcut?

Thanks!