From c0109d948f9d562899795abf15fae5c83c96f21e Mon Sep 17 00:00:00 2001
From: Thomas Weinert <thomas@weinert.info>
Date: Sat, 12 Aug 2017 13:38:46 +0200
Subject: [PATCH] Block F5 in speaker notes window, avoid disconnects

---
 plugin/notes/notes.html | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html
index 4c5b799b..9922a296 100644
--- a/plugin/notes/notes.html
+++ b/plugin/notes/notes.html
@@ -427,10 +427,16 @@
 				 * Forward keyboard events to the current slide window.
 				 * This enables keyboard events to work even if focus
 				 * isn't set on the current slide iframe.
+				 *
+				 * Block F5 default handling, it reloads and disconnects
+				 * the speaker notes window.
 				 */
 				function setupKeyboard() {
 
 					document.addEventListener( 'keydown', function( event ) {
+						if (event.keyCode === 116) {
+							event.preventDefault();
+						}
 						currentSlide.contentWindow.postMessage( JSON.stringify({ method: 'triggerKey', args: [ event.keyCode ] }), '*' );
 					} );
 
-- 
GitLab