Our brain is primordially designed to react to distractions - because it was a matter of survival or death. Media has adapted itself to harness this feature of our brains. To counter it, we have to take out much of the possible avenues to distractions out of our extrapersonal space or sight range (because we're visual creatures, out of sight = out of mind).
For more details, Andrew Huberman has a whole episode on focus and concentration that talks about this.