Closed arnaud closed 9 years ago
Could you explain exactly what you mean by autofocus?
By autofocus, I refer to the following behavior: when my webpage has finished loading, the cursor is automatically set in the message input field (#candy .message-form [name="message"]
) of the Candy view.
Now imagine you embed your candy view at the very bottom of your webpage. When you open the webpage and it finished loading, your browser will automatically scroll to the very bottom, and focus the message field.
Before initializing Candy, add the following two lines in your html file:
Candy.View.Pane.Window.onFocus = function() {};
Candy.View.Pane.Window.onBlur = function() {};
Thanks for the quick answer. However the proposed solution didn't work:
Candy.View.Pane.Window.onFocus = function() { console.debug("onFocus", this) };
Candy.View.Pane.Window.onBlur = function() { console.debug("onBlur", this) };
Candy.init(...);
Candy.Core.connect(...);
The behavior was still the same (autofocus still on), and my console did not mention anything upon loading. Suggesting that these methods were not triggered.
What works for me though, on both FF and Chrome is:
Candy.View.Pane.Room.setFocusToForm = function() {};
Cheers
We embed the candy chat client in a forum website, and the autofocus is very painful for us to say the least. Is there a way to deactivate autofocus so that the browser won't scroll automatically upon each and every navigation?