const el = document.documentElement || document.body
const originHeight = el.clientHeight
window.addEventListener('resize'.() = > {
  const resizeHeight = el.clientHeight
  if (resizeHeight >= originHeight) {
    console.log('Put the keyboard away')
    // Manually trigger the blur method when Android closes the keyboard
    if ( document.activeElement.tagName && document.activeElement.tagName.toUpperCase() === 'INPUT') {document.activeElement.blur && document.activeElement.blur()
    }
  }
}, false)
Copy the code