You can enable auto-targeting in Dragonflight. When enabled, the option will target the enemy you’re facing if you have no target selected.
The option can be enabled with the following command: /console SoftTargetEnemy 3. In the Dragonflight pre-patch, you’ll be able to turn it on and off directly through Game Settings.
If you have a target selected (including targets you select with the Tab key), the option won’t work.