Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Primus breaks Esc to close <dialog> #782

Closed
eatyourgreens opened this issue Nov 3, 2023 · 0 comments · Fixed by #783
Closed

Primus breaks Esc to close <dialog> #782

eatyourgreens opened this issue Nov 3, 2023 · 0 comments · Fixed by #783

Comments

@eatyourgreens
Copy link
Contributor

eatyourgreens commented Nov 3, 2023

primus/primus.js

Lines 1159 to 1174 in ed70022

//
// Hack 2: If you press ESC in FireFox it will close all active connections.
// Normally this makes sense, when your page is still loading. But versions
// before FireFox 22 will close all connections including WebSocket connections
// after page load. One way to prevent this is to do a `preventDefault()` and
// cancel the operation before it bubbles up to the browsers default handler.
// It needs to be added as `keydown` event, if it's added keyup it will not be
// able to prevent the connection from being closed.
//
if (document.addEventListener) {
document.addEventListener('keydown', function keydown(e) {
if (e.keyCode !== 27 || !e.preventDefault) return;
e.preventDefault();
}, false);
}

Primus swallows keydown here for the Esc key, which has the side effect of breaking Esc to close open <dialog> elements.

Since the original code was added to fix a bug in Firefox 22, would it be ok to remove it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant