This is what I got.

Even if I place it in the far upper right corner, the window doesn't change its position as needed, so I lowered it slightly so that the pop-up window wouldn't cover the button.

Added 21 hours 25 minutes ago
I'm struggling with one idea, namely disabling it with Esc. I found a similar implementation in the doc skills mod by Azarda. In the character menu, "Skills," pressing a button opens a window with a wheel, and pressing Esc closes it. The same thing exists in the modified version by vova2112, but already on the global map, where a table for raising undead appears.
I reviewed both versions countless times, and no matter how hard I try, I really don't understand where this is written or how it's implemented. If it's possible and someone knows how to implement it, please help.
Link to the mod /topic/15183/
It seems like I figured it out and added the ability to disable it with Esc, but there's a problem. The button remains in the "active" position after being disabled with Esc. As a result, it gets pressed without effect and only activates the window with the table on the second press.