You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Nick Pratt (JIRA)" <ji...@apache.org> on 2011/04/20 15:53:05 UTC

[jira] [Commented] (WICKET-3626) Attaching AjaxEventBehavior or AjaxFormComponentUpdatingBehavior causes erratic focus in TextArea

    [ https://issues.apache.org/jira/browse/WICKET-3626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13022129#comment-13022129 ] 

Nick Pratt commented on WICKET-3626:
------------------------------------

I checked with Chrome 10.0.648.205 and Safari on Mac OS X 10.6.6 and it works fine. Ive not tried with IE.

> Attaching AjaxEventBehavior or AjaxFormComponentUpdatingBehavior causes erratic focus in TextArea
> -------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-3626
>                 URL: https://issues.apache.org/jira/browse/WICKET-3626
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 1.4.17
>         Environment: Firefox 3.6.16, Mac OS X 10.6.6
>            Reporter: Nick Pratt
>              Labels: Ajax, TextArea
>
> The TextArea is set for 8 rows.  Enter 9 rows worth of text (with CR/LF to separate each line).  Once you hit the scroll point, and enter another character, the TextArea scrolls back up the top of the viewport.  Now put the cursor at the end of line 1.  Start typing - the behavior is more erratic than before.  Wicket debug window shows a couple of refocus operations (output at end)
> Sample Page:
> ===========
> 	private String textAreaStr = "No Text";
> 	private String labelStr = "";
> 	public DevPage()
> 	{
> 		Form form = new Form( "form" );
> 		add( form );
> 		final Label label = new Label( "textArea", new PropertyModel<String>( this, "labelStr" ) );
> 		label.setOutputMarkupId( true );
> 		label.setEscapeModelStrings( false );
> 		add( label );
> 		TextArea textArea = new TextArea( "test", new PropertyModel<String>( this, "textAreaStr" ) );
> 		form.add( textArea );
> 		AjaxFormComponentUpdatingBehavior formComponentUpdatingBehavior = new AjaxFormComponentUpdatingBehavior( "onkeyup" )
> 		{
> 			@Override
> 			protected void onUpdate( AjaxRequestTarget target )
> 			{
> 				labelStr = textAreaStr;
> 				target.addComponent( label );
> 			}
> 		};
> 		formComponentUpdatingBehavior.setThrottleDelay( Duration.milliseconds( 100 ) );
> 		textArea.add( formComponentUpdatingBehavior );
> 	}
> Sample HTML:
> ===========
> <wicket:extend>
> 	<form wicket:id="form">
> 		<textarea wicket:id="test" rows="8" cols="80"></textarea>
> 	</form>
> 	<div wicket:id="textArea"></div>
> </wicket:extend>
> Wicket Ajax Debug Output:
> =====================
> INFO: focus set on teste
> INFO:
> INFO: Initiating Ajax POST request on ?wicket:interface=:3:form:test::IBehaviorListener:0:&random=0.5912934137918602
> INFO: Invoking pre-call handler(s)...
> INFO: Received ajax response (191 characters)
> INFO:
> <?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="textAreaf" ><![CDATA[<div id="textAreaf">No Text
> More Text
> 3
> 4
> 5
> 6
> 7
> 8
> 9s
> 0
> 10
> 12
> 13</div>]]></component></ajax-response>
> INFO: Response parsed. Now invoking steps...
> INFO: returned focused element: [object HTMLTextAreaElement]
> INFO: returned focused element: [object HTMLTextAreaElement]
> INFO: Response processed successfully.
> INFO: Invoking post-call handler(s)...
> INFO: refocus last focused component not needed/allowed

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira