# HG changeset patch # User souliane # Date 1381422547 -7200 # Node ID 531b8809d1ab1002e72e82047654fc5a3a8bc626 # Parent 9b078380dacfee3a088b530bde4672254a16f99e browser_side: fixed browser built-in auto-completion in login/register panels diff -r 9b078380dacf -r 531b8809d1ab browser_side/register.py --- a/browser_side/register.py Thu Nov 07 15:22:28 2013 +0100 +++ b/browser_side/register.py Thu Oct 10 18:29:07 2013 +0200 @@ -39,6 +39,7 @@ from pyjamas import Window from pyjamas.ui.KeyboardListener import KEY_ESCAPE, KEY_ENTER import re +from pyjamas.Timer import Timer class RegisterPanel(FormPanel): @@ -154,14 +155,18 @@ def onKeyPress(self, sender, keycode, modifiers): if keycode == KEY_ENTER: + # Browsers offer an auto-completion feature to any + # text box, but the selected value is not set when + # the widget looses the focus. Using a timer with + # any delay value > 0 would do the trick. if sender == self.login_box: - self.login_pass_box.setFocus(True) + Timer(10, lambda: self.login_pass_box.setFocus(True)) elif sender == self.login_pass_box: self.onLogin(None) elif sender == self.register_login_box: - self.email_box.setFocus(True) + Timer(10, lambda: self.email_box.setFocus(True)) elif sender == self.email_box: - self.register_pass_box.setFocus(True) + Timer(10, lambda: self.register_pass_box.setFocus(True)) elif sender == self.register_pass_box: self.onRegister(None)