Merge pull request #2718 from ethereum/rename-menu

Fixed wrong position of rename menu
pull/1/head
yann300 5 years ago committed by GitHub
commit 3653a38d67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/app/ui/contextMenu.js

@ -45,12 +45,22 @@ module.exports = (event, items) => {
current.onclick = () => { hide(null, true); items[item]() }
return current
})
const container = yo`<div class="p-1 ${css.container} bg-light shadow border"><ul id='menuitems'>${menu}</ul></div>`
const container = yo`<div id="menuItemsContainer" class="p-1 ${css.container} bg-light shadow border"><ul id='menuitems'>${menu}</ul></div>`
container.style.left = event.pageX + 'px'
container.style.top = event.pageY + 'px'
container.style.display = 'block'
document.querySelector('body').appendChild(container)
const menuItemsContainer = document.getElementById('menuItemsContainer')
const boundary = menuItemsContainer.getBoundingClientRect()
if (boundary.bottom > (window.innerHeight || document.documentElement.clientHeight)) {
menuItemsContainer.style.position = 'absolute'
menuItemsContainer.style.bottom = '10px'
menuItemsContainer.style.top = null
}
setTimeout(() => {
window.addEventListener('click', hide)
}, 500)

Loading…
Cancel
Save