Commit 6880eeaa authored by Ionel Popescu's avatar Ionel Popescu Committed by Commit Bot

Fixed color picker format toggler for touch input.

Calling preventDefault for touchstart is going to suppress the click
event that actually updates the color format.

The fix here is to simply avoid handling the touchstart event since the
default behavior is doing what we want.

Bug: 1068066, 1069818
Change-Id: I9990d2001a2de8978019053b4615f7bbf2676372
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144460
Commit-Queue: Ionel Popescu <iopopesc@microsoft.com>
Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758333}
parent c5e19a6e
......@@ -1884,7 +1884,6 @@ class FormatToggler extends HTMLElement {
this.addEventListener('click', this.onClick_);
this.addEventListener('keydown', this.onKeyDown_);
this.addEventListener('mousedown', (event) => event.preventDefault());
this.addEventListener('touchstart', (event) => event.preventDefault());
}
/**
......
<!DOCTYPE html>
<html>
<head>
<script>
testRunner.waitUntilDone();
</script>
<script src='../../../fast/forms/resources/picker-common.js'></script>
</head>
<body>
<input type='color' id='color' value='#7EFFC9'>
<p id='description' style='opacity: 0'></p>
<div id='console' style='opacity: 0'></div>
<script>
openPicker(document.getElementById('color'), openPickerSuccessfulCallback, () => testRunner.notifyDone());
function openPickerSuccessfulCallback() {
popupWindow.focus();
const popupDocument = popupWindow.document;
const formatToggler = popupDocument.querySelector('format-toggler');
const formatTogglerRect = formatToggler.getBoundingClientRect();
// // first tap changes format to HSL
eventSender.gestureTap(formatTogglerRect.left + formatTogglerRect.width / 3, formatTogglerRect.top + formatTogglerRect.height / 3);
// second tap changes format to Hex
eventSender.gestureTap(formatTogglerRect.left + formatTogglerRect.width / 2, formatTogglerRect.top + formatTogglerRect.height / 2);
testRunner.notifyDone();
}
</script>
</body>
</html>
\ No newline at end of file
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