Since all the script does is put a border around the currently focused window, when the focused window is under another window, the highlight is done without checking whether the windows are on top of each other or not.
In this example, there are 2 floating windows. One running nvim and the other running the terminal. Nvim window is on top of the terminal but the terminal is in focus.

Since all the script does is put a border around the currently focused window, when the focused window is under another window, the highlight is done without checking whether the windows are on top of each other or not.
In this example, there are 2 floating windows. One running nvim and the other running the terminal. Nvim window is on top of the terminal but the terminal is in focus.