Commit c3d320e1 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Files app: Fix infinite recursion on search's clear button

Change command default handler for copy/paste/cut/delete to only set
|canExecute| when focusing the element where the default handler was
forced.

This fixes the infinite recursion on <cr-input> and its clear button,
because the handler is forced in the <cr-input> and but the focus
event was triggered in its children <cr-button> (clear button). These
commands should be noop in buttons, these are forced for inputs to be
able to copy/paste/etc the text in the input.

Our error counter doesn't capture this error, so our integration test
can't detect it.

Test: Manually checked.
Bug: 1029213
Fixed: 1029213
Change-Id: I4a9f9d0e05dee8eb18a06359f770498011db0487
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1939999
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719928}
parent fe0b28d0
...@@ -180,7 +180,7 @@ CommandUtil.forceDefaultHandler = (node, commandId) => { ...@@ -180,7 +180,7 @@ CommandUtil.forceDefaultHandler = (node, commandId) => {
event.cancelBubble = true; event.cancelBubble = true;
}); });
node.addEventListener('canExecute', event => { node.addEventListener('canExecute', event => {
if (event.command.id !== commandId) { if (event.command.id !== commandId || event.target !== node) {
return; return;
} }
event.canExecute = document.queryCommandEnabled(event.command.id); event.canExecute = document.queryCommandEnabled(event.command.id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment