From: Robert Timm <mail@rtti.de>
Date: Sat, 25 Feb 2017 23:29:12 +0000 (+0100)
Subject: fixes (shift)tab cycling through editable elements
X-Git-Url: https://git.owens.tech/wrapped.html/wrapped.html/git?a=commitdiff_plain;h=495727fb19cc83289fa4ba90c91590d28ea7e740;p=vimb.git

fixes (shift)tab cycling through editable elements
---

diff --git a/src/input.c b/src/input.c
index afa9360..6236c9d 100644
--- a/src/input.c
+++ b/src/input.c
@@ -38,6 +38,7 @@ void input_enter(Client *c)
      * disturbing the user */
     gtk_widget_grab_focus(GTK_WIDGET(c->webview));
     vb_modelabel_update(c, "-- INPUT --");
+    webkit_web_view_run_javascript(c->webview, "var vimb_input_mode_element = document.activeElement;", NULL, NULL, NULL);
 }
 
 /**
@@ -45,7 +46,7 @@ void input_enter(Client *c)
  */
 void input_leave(Client *c)
 {
-    webkit_web_view_run_javascript(c->webview, "document.activeElement.blur();", NULL, NULL, NULL);
+    webkit_web_view_run_javascript(c->webview, "vimb_input_mode_element.blur();", NULL, NULL, NULL);
     vb_modelabel_update(c, "");
 }
 
diff --git a/src/normal.c b/src/normal.c
index 7410fb9..e92de75 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -215,7 +215,6 @@ extern struct Vimb vb;
  */
 void normal_enter(Client *c)
 {
-    webkit_web_view_run_javascript(c->webview, "document.activeElement.blur();", NULL, NULL, NULL);
     /* Make sure that when the browser area becomes visible, it will get mouse
      * and keyboard events */
     gtk_widget_grab_focus(GTK_WIDGET(c->webview));
@@ -322,6 +321,7 @@ void pass_enter(Client *c)
  */
 void pass_leave(Client *c)
 {
+    webkit_web_view_run_javascript(c->webview, "document.activeElement.blur();", NULL, NULL, NULL);
     vb_modelabel_update(c, "");
 }