The username input is automatically focused and the key press is consumed by the input field itself, stopping the event from propagating upwards. As far as the dialog is concerned, the escape key was never pressed.
The escape key can have a special meaning inside the input field depending on the browser, for example it can cancel out an auto-complete suggestion and generally whatever the browser (and its extensions) think makes sense. As a result it is impossible to reliably determine if the escape key was meant to close the dialog or if some other action was executed in the process.
Long story short: The browser canceled the escape event before it reached the dialog container, this is not a bug but the way browsers work.