Commit d82b9f56 authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

[NTP][RQ] Fixes bug where clicking MV tile buttons results in navigation

After crrev.com/c/2527531, clicking the MV tile action menu or delete
button results in navigation to the MV tile's destination URL.

Prior to crrev.com/c/2527531, calling preventDefault() on the click
event targeted at the action menu or the delete buttons would have
prevented the default browser action on the parent <a> element. After
the said change, navigations are no longer handled implicitly and thus
a navigation occurs in NewTabPageHandler::OnMostVisitedTileNavigation.

This CL fixes that bug by ignoring previously handled events targeted
at the tile's child elements.

Fixed: 1147255, 1147746
Change-Id: I71749e533f23689ce7a869b74d6df65a3e44497d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2531357Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Commit-Queue: Esmael Elmoslimany <aee@chromium.org>
Auto-Submit: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826432}
parent cc317d1b
......@@ -704,6 +704,11 @@ class MostVisitedElement extends PolymerElement {
* @private
*/
onTileClick_(e) {
if (e.defaultPrevented) {
// Ignore previousely handled events.
return;
}
if (loadTimeData.getBoolean('handleMostVisitedNavigationExplicitly')) {
e.preventDefault(); // Prevents default browser action (navigation).
}
......
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