Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I have inserted the link <a href="#" onclick="javascript: Drupal.Teleport.toggle(); return false;">help button</a>. Teleport appears and there and then disappears. In what a problem?
The problem is that the toggle() function adds a click() handler to the document that checks to see if a click is outside the Teleport dialog. If it is outside the dialog, the dialog closes. Unfortunately, if you've activated the dialog using a click, that new handler gets run after the toggle() handler. The new handler, seeing that the click was outside the teleport window, closes the window that just opened.
A workaround is to remove the new handler at the end of the onclick:
Comments
Comment #1
digital_fox commentedI have inserted the link
<a href="#" onclick="javascript: Drupal.Teleport.toggle(); return false;">help button</a>. Teleport appears and there and then disappears. In what a problem?Comment #2
incidentist commentedThe problem is that the toggle() function adds a click() handler to the document that checks to see if a click is outside the Teleport dialog. If it is outside the dialog, the dialog closes. Unfortunately, if you've activated the dialog using a click, that new handler gets run after the toggle() handler. The new handler, seeing that the click was outside the teleport window, closes the window that just opened.
A workaround is to remove the new handler at the end of the onclick: