Слушайте мероприятие Cleaboard Close в JS
// event listener is triggered when keyboard is open or closed
window.visualViewport.addEventListener('resize', event => console.log(event.target));
Anxious Alligator