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 #8036 from brave/extension-popup-position
Browse files Browse the repository at this point in the history
Provide popup coords on keypress
  • Loading branch information
bsclifton authored Apr 7, 2017
2 parents 10539c2 + 4d5500b commit d3f83cb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/renderer/components/browserAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ class BrowserAction extends ImmutableComponent {
windowActions.setPopupWindowDetail()
return
}
let centerX
let centerY
if (!e.nativeEvent.x || !e.nativeEvent.y) {
// Handles case where user focuses button, and presses Enter
let { top: offsetTop, left: offsetLeft } = e.target.getBoundingClientRect()
centerX = offsetLeft + (e.target.offsetWidth * 0.5)
centerY = offsetTop + (e.target.offsetHeight * 0.5)
}
let props = {
x: e.nativeEvent.x,
y: e.nativeEvent.y,
x: e.nativeEvent.x || centerX,
y: e.nativeEvent.y || centerY,
screenX: e.nativeEvent.screenX,
screenY: e.nativeEvent.screenY,
offsetX: e.nativeEvent.offsetX,
Expand Down

0 comments on commit d3f83cb

Please sign in to comment.