Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/ui/filters-filteractions.js

Issue 4834220086132736: Issue 256 - Home/End keys are broken when editing a filter (Closed)
Patch Set: Created May 8, 2014, 6:59 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/filters-filteractions.js
===================================================================
--- a/chrome/content/ui/filters-filteractions.js
+++ b/chrome/content/ui/filters-filteractions.js
@@ -28,22 +28,27 @@ var FilterActions =
{
let me = this;
this.treeElement.parentNode.addEventListener("keypress", function(event)
{
me.keyPress(event);
}, true);
this.treeElement.view = FilterView;
- this.treeElement.inputField.addEventListener("keypress", function(event)
+ // Work around https://bugzilla.mozilla.org/show_bug.cgi?id=777832, don't
+ // allow the tree to receive keypress/keydown events triggered by cursor
+ // keys pressed in the editor, it will call preventDefault() on them.
+ let propagationStopper = function(event)
{
- // Prevent the tree from capturing cursor keys pressed in the input field
if (event.keyCode >= event.DOM_VK_PAGE_UP && event.keyCode <= event.DOM_VK_DOWN)
event.stopPropagation();
- }, false);
+ };
+
+ this.treeElement.inputField.addEventListener("keypress", propagationStopper, false);
+ this.treeElement.inputField.addEventListener("keydown", propagationStopper, false);
// Create a copy of the view menu
function fixId(node, newId)
{
if (node.nodeType == node.ELEMENT_NODE)
{
if (node.hasAttribute("id"))
node.setAttribute("id", node.getAttribute("id").replace(/\d+$/, newId));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld