Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Tweaks to fix autofill context menu position #3389

Merged
merged 1 commit into from
Aug 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}))
}
Expand Down