Motivation:
When the UI completely re-renders (like when switching between English and Chinese), the old DOM gets destroyed but the window event listener was not properly cleared and the new modal failed to reattach the listener effectively, breaking the ESC key to close.
Implementation:
Added cleanup logic before attaching a new 'keydown' listener to the window object to ensure the _escListener stays active.