Index: go-back-with-backspace/content_script.js |
diff --git a/go-back-with-backspace/content_script.js b/go-back-with-backspace/content_script.js |
index cc7fca6218a17ebc7f28b84725daee28d3925a22..b90e05afe20bdab045c87be64f4f45a63b124315 100644 |
--- a/go-back-with-backspace/content_script.js |
+++ b/go-back-with-backspace/content_script.js |
@@ -44,14 +44,16 @@ function handleBackspace(e) { |
return; |
// The whitelist overrides applet focus. |
- // Listening on the Window means the event has no path (see |
- // http://crbug.com/645527), so we'll have to look at the focused (active) |
- // element. This means it will not work properly with shadow DOM. |
- // TODO: Fix behavior with shadow DOM when the above bug is resolved. |
- if (!options.whitelist.includes(url) && |
- disabledInApplet(document.activeElement)) |
+ // Before Chrome 55, listening on the Window means the event has no path, |
+ // instead pointing to the Window (see http://crbug.com/645527). In that |
+ // case, we have to look at the focused (active) element. |
+ // TODO: Switch entirely to e.path once Chrome 55 is launched. |
+ var target = e.path[0]; |
+ if (target === window) |
+ target = document.activeElement; |
+ if (!options.whitelist.includes(url) && disabledInApplet(target)) |
Devlin
2016/11/01 15:12:14
nit: seems like the options.whitelist check should
|
return; |
- if (isEditable(document.activeElement)) |
+ if (isEditable(target)) |
return; |
// Make sure this extension is still active. |