A fire alarm NA at the local Lowes and shelf

This is at the local Lowes. It looks like this NA was once at least partially inside the shelf because of the opening. Wouldn’t this be against code? It lessens the effects of the strobe.

Yes, I’m pretty sure it would be against code.