From ceb48ceb2516a7c808bb8501f1e6ff450de312b6 Mon Sep 17 00:00:00 2001 From: Brian Clifton Date: Wed, 24 Aug 2016 15:22:02 -0700 Subject: [PATCH] Tweaks to fix autofill context menu position Fixes https://github.com/brave/browser-laptop/issues/3359 Depends on https://github.com/brave/electron/pull/44 --- js/contextMenus.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/contextMenus.js b/js/contextMenus.js index 29ec52b397f..a6d6c8295a3 100644 --- a/js/contextMenus.js +++ b/js/contextMenus.js @@ -375,10 +375,10 @@ function usernameTemplateInit (usernames, origin, action) { } function autofillTemplateInit (suggestions, frame) { - let items = [] + const items = [] for (let i = 0; i < suggestions.length; ++i) { let value - let frontendId = suggestions[i].frontend_id + const frontendId = suggestions[i].frontend_id if (frontendId >= 0) { // POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY and Autofill Entry value = suggestions[i].value } else if (frontendId === -1) { // POPUP_ITEM_ID_WARNING_MESSAGE @@ -1091,9 +1091,13 @@ function onShowUsernameMenu (usernames, origin, action, boundingRect, function onShowAutofillMenu (suggestions, boundingRect, frame) { const menuTemplate = autofillTemplateInit(suggestions, frame) + const offset = { + x: (window.innerWidth - boundingRect.clientWidth), + y: (window.innerHeight - boundingRect.clientHeight) + } windowActions.setContextMenuDetail(Immutable.fromJS({ - left: boundingRect.x, - top: boundingRect.y, + left: offset.x + boundingRect.x, + top: offset.y + (boundingRect.y + boundingRect.height), template: menuTemplate })) }