dPanel = document.getElementById('keyboard-container');
          kbdPanel.style.display = 'none';
          mathVirtualKeyboard.visible = false;
        }
      });

      window.addEventListener('resize', () => positionPopupKeyboard());

      function positionPopupKeyboard() {
        const mf = document.activeElement;
        const kbdPanel = document.getElementById('keyboard-container');

        if (mf.tagName !== 'MATH-FIELD') {
          kbdPanel.style.display = 'none';
          return;
        }
 