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

Commit

Permalink
Merge pull request #3389 from bsclifton/fix-autofill-position
Browse files Browse the repository at this point in the history
Tweaks to fix autofill context menu position
  • Loading branch information
bridiver authored Aug 25, 2016
2 parents 1c54ee8 + ceb48ce commit 86f49ce
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 86f49ce

Please sign in to comment.