1313# Known issue on Linux: When typing url, mouse must be over url
1414# entry widget otherwise keyboard focus is lost (Issue #255
1515# and Issue #284).
16+ # Other focus issues discussed in Issue #535.
17+
1618
1719from cefpython3 import cefpython as cef
1820import ctypes
@@ -153,6 +155,7 @@ def __init__(self, master, navigation_bar=None):
153155 self .bind ("<FocusIn>" , self .on_focus_in )
154156 self .bind ("<FocusOut>" , self .on_focus_out )
155157 self .bind ("<Configure>" , self .on_configure )
158+ """For focus problems see Issue #255 and Issue #535. """
156159 self .focus_set ()
157160
158161 def embed_browser (self ):
@@ -216,8 +219,6 @@ def on_focus_in(self, _):
216219
217220 def on_focus_out (self , _ ):
218221 logger .debug ("BrowserFrame.on_focus_out" )
219- if self .browser :
220- self .browser .SetFocus (False )
221222
222223 def on_root_close (self ):
223224 if self .browser :
@@ -242,6 +243,7 @@ def OnLoadStart(self, browser, **_):
242243
243244
244245class FocusHandler (object ):
246+ """For focus problems see Issue #255 and Issue #535. """
245247
246248 def __init__ (self , browser_frame ):
247249 self .browser_frame = browser_frame
@@ -253,13 +255,10 @@ def OnTakeFocus(self, next_component, **_):
253255 def OnSetFocus (self , source , ** _ ):
254256 logger .debug ("FocusHandler.OnSetFocus, source={source}"
255257 .format (source = source ))
256- return False
258+ return True
257259
258260 def OnGotFocus (self , ** _ ):
259- """Fix CEF focus issues (#255). Call browser frame's focus_set
260- to get rid of type cursor in url entry widget."""
261261 logger .debug ("FocusHandler.OnGotFocus" )
262- self .browser_frame .focus_set ()
263262
264263
265264class NavigationBar (tk .Frame ):
@@ -340,7 +339,7 @@ def on_load_url(self, _):
340339 self .master .get_browser ().LoadUrl (self .url_entry .get ())
341340
342341 def on_button1 (self , _ ):
343- """Fix CEF focus issues ( #255). See also FocusHandler.OnGotFocus. """
342+ """For focus problems see Issue #255 and Issue #535. """
344343 logger .debug ("NavigationBar.on_button1" )
345344 self .master .master .focus_force ()
346345
0 commit comments