According to Wikipedia, In user interface design for computer applications, a modal window is a graphical control element subordinate to an application's main window.
A modal window provides a mode in which the primary window is disabled but remains visible, with the modal window acting as a child window in front of it. Before returning to the parent application, users must engage with the modal window. This prevents the main window's operation from being disrupted. Because they frequently display a dialog box, modal windows are sometimes known as heavy windows or modal dialogs.
The code is easy to understand. We recommend you watch this video alongside the code. It will help you to understand the code better.