Commit ed4b880c authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

WebUI NTP: focus on fakebox when touched

Depending on what has focus, mousedown event may not be emitted when
a user touches an element. Elements should handle the pointerdown event
instead.

Change-Id: I255812428698be93b547869f6b2674ad6f86047a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2141201
Commit-Queue: Esmael Elmoslimany <aee@chromium.org>
Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757531}
parent 7d61e42d
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
box-shadow: 0 0 0 2px var(--ntp-focus-shadow-color); box-shadow: 0 0 0 2px var(--ntp-focus-shadow-color);
} }
</style> </style>
<input id="input" on-mousedown="onMousedown_" on-paste="onPaste_" <input id="input" on-pointerdown="onPointerDown_" on-paste="onPaste_"
on-dragenter="onDragenter_" on-dragleave="onDragleave_" on-drop="onDrop_" on-dragenter="onDragenter_" on-dragleave="onDragleave_" on-drop="onDrop_"
autocomplete="off" tabindex="-1" type="url" aria-hidden="true"> autocomplete="off" tabindex="-1" type="url" aria-hidden="true">
</input> </input>
......
...@@ -75,7 +75,7 @@ class FakeboxElement extends PolymerElement { ...@@ -75,7 +75,7 @@ class FakeboxElement extends PolymerElement {
} }
/** @private */ /** @private */
onMousedown_() { onPointerDown_() {
this.pageHandler_.focusOmnibox(); this.pageHandler_.focusOmnibox();
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
import 'chrome://new-tab-page/fakebox.js'; import 'chrome://new-tab-page/fakebox.js';
import {BrowserProxy} from 'chrome://new-tab-page/browser_proxy.js'; import {BrowserProxy} from 'chrome://new-tab-page/browser_proxy.js';
import {down} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js';
import {assertNotStyle, assertStyle, createTestProxy, NONE_ANIMATION} from 'chrome://test/new_tab_page/test_support.js'; import {assertNotStyle, assertStyle, createTestProxy, NONE_ANIMATION} from 'chrome://test/new_tab_page/test_support.js';
import {eventToPromise} from 'chrome://test/test_util.m.js'; import {eventToPromise} from 'chrome://test/test_util.m.js';
...@@ -88,7 +87,7 @@ suite('NewTabPageFakeboxTest', () => { ...@@ -88,7 +87,7 @@ suite('NewTabPageFakeboxTest', () => {
test('on mouse down focuses omnibox', async () => { test('on mouse down focuses omnibox', async () => {
// Act. // Act.
down(fakebox.$.input); fakebox.$.input.dispatchEvent(new PointerEvent('pointerdown'));
// Assert. // Assert.
await testProxy.handler.whenCalled('focusOmnibox'); await testProxy.handler.whenCalled('focusOmnibox');
......
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