You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Erwin Bolwidt (JIRA)" <ji...@apache.org> on 2012/05/02 13:10:52 UTC

[jira] [Created] (WICKET-4529) AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5

Erwin Bolwidt created WICKET-4529:
-------------------------------------

             Summary: AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5
                 Key: WICKET-4529
                 URL: https://issues.apache.org/jira/browse/WICKET-4529
             Project: Wicket
          Issue Type: Bug
          Components: wicket-extensions
    Affects Versions: 1.5.5
         Environment: MacOS
            Reporter: Erwin Bolwidt


The class Javadoc for AjaxEditableLabel says:
{quote}
onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
{quote}

However this does not happen on Firefox or Safari.
Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)

{code}
                // put focus on the textfield and stupid explorer hack to move the
		// caret to the end
		target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
			"   if (el.createTextRange) { " +
			"     var v = el.value; var r = el.createTextRange(); " +
			"     r.moveStart('character', v.length); r.select(); } }");
		target.focusComponent(editor);
{code}

However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.

{code}
                // put focus on the textfield and stupid explorer hack to move the
		// caret to the end
		target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
			"   el.select(); " +
                        " }");
		target.focusComponent(editor);
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4529) AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5

Posted by "Andrea Del Bene (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274261#comment-13274261 ] 

Andrea Del Bene commented on WICKET-4529:
-----------------------------------------

@Martin

 select() should work also for Firefox. How did you test your JavaScript code (with firebug console?)?. I've changed code as suggested by Erwin and tested it with example /wicket-examples/ajax/editable-label. Everything was fine with the following configurations:

-Firefox 12 under Ubuntu
-Chromium 18 under Ubuntu
-Firefox 11 and 12 under Windows xp
-Opera 11.64 under Windows xp
-Safari 5.1.7 under Windows xp
-IE 7 and 8 under Windows xp

                
> AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-4529
>                 URL: https://issues.apache.org/jira/browse/WICKET-4529
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.5.5
>         Environment: MacOS
>            Reporter: Erwin Bolwidt
>
> The class Javadoc for AjaxEditableLabel says:
> """
> onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
> """
> However this does not happen on Firefox or Safari.
> Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   if (el.createTextRange) { " +
> 	"     var v = el.value; var r = el.createTextRange(); " +
> 	"     r.moveStart('character', v.length); r.select(); } }");
> target.focusComponent(editor);
> However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
> I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   el.select(); " +
>         " }");
> target.focusComponent(editor);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4529) AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5

Posted by "Andrea Del Bene (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Del Bene updated WICKET-4529:
------------------------------------

    Attachment: TestScreenshot.png
    
> AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-4529
>                 URL: https://issues.apache.org/jira/browse/WICKET-4529
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.5.5
>         Environment: MacOS
>            Reporter: Erwin Bolwidt
>         Attachments: TestScreenshot.png
>
>
> The class Javadoc for AjaxEditableLabel says:
> """
> onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
> """
> However this does not happen on Firefox or Safari.
> Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   if (el.createTextRange) { " +
> 	"     var v = el.value; var r = el.createTextRange(); " +
> 	"     r.moveStart('character', v.length); r.select(); } }");
> target.focusComponent(editor);
> However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
> I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   el.select(); " +
>         " }");
> target.focusComponent(editor);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4529) AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5

Posted by "Andrea Del Bene (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274288#comment-13274288 ] 

Andrea Del Bene commented on WICKET-4529:
-----------------------------------------

@Marting

well...I know it could sound silly :), but I've asked you if you used firebug because the first time I tried your code I also thought it didn't work. But later I realised that if you click on page before running your script, everything works as expected (see attached picture with firefox 11)
                
> AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-4529
>                 URL: https://issues.apache.org/jira/browse/WICKET-4529
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.5.5
>         Environment: MacOS
>            Reporter: Erwin Bolwidt
>
> The class Javadoc for AjaxEditableLabel says:
> """
> onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
> """
> However this does not happen on Firefox or Safari.
> Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   if (el.createTextRange) { " +
> 	"     var v = el.value; var r = el.createTextRange(); " +
> 	"     r.moveStart('character', v.length); r.select(); } }");
> target.focusComponent(editor);
> However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
> I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   el.select(); " +
>         " }");
> target.focusComponent(editor);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (WICKET-4529) AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-4529.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 6.0.0-RC1
                   1.5.7
         Assignee: Martin Grigorov
    
> AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-4529
>                 URL: https://issues.apache.org/jira/browse/WICKET-4529
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.5.5
>         Environment: MacOS
>            Reporter: Erwin Bolwidt
>            Assignee: Martin Grigorov
>             Fix For: 1.5.7, 6.0.0-RC1
>
>         Attachments: TestScreenshot.png
>
>
> The class Javadoc for AjaxEditableLabel says:
> """
> onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
> """
> However this does not happen on Firefox or Safari.
> Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   if (el.createTextRange) { " +
> 	"     var v = el.value; var r = el.createTextRange(); " +
> 	"     r.moveStart('character', v.length); r.select(); } }");
> target.focusComponent(editor);
> However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
> I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   el.select(); " +
>         " }");
> target.focusComponent(editor);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4529) AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13269682#comment-13269682 ] 

Martin Grigorov commented on WICKET-4529:
-----------------------------------------

I just tried 

document.getElementsByName("text")[0].select()

at http://www.wicket-library.com/wicket-examples/compref/wicket/bookmarkable/org.apache.wicket.examples.compref.TextFieldPage

and it works on IE9, Opera 11.61, Safari 5.1.5 and Chrome 18.x (Win7) and 20.x (Ubuntu). It doesn't work on Firefox 11 (both Win7 and Ubuntu).
                
> AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-4529
>                 URL: https://issues.apache.org/jira/browse/WICKET-4529
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.5.5
>         Environment: MacOS
>            Reporter: Erwin Bolwidt
>
> The class Javadoc for AjaxEditableLabel says:
> """
> onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
> """
> However this does not happen on Firefox or Safari.
> Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   if (el.createTextRange) { " +
> 	"     var v = el.value; var r = el.createTextRange(); " +
> 	"     r.moveStart('character', v.length); r.select(); } }");
> target.focusComponent(editor);
> However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
> I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   el.select(); " +
>         " }");
> target.focusComponent(editor);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (WICKET-4529) AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5

Posted by "Erwin Bolwidt (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4529?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Erwin Bolwidt updated WICKET-4529:
----------------------------------

    Description: 
The class Javadoc for AjaxEditableLabel says:
"""
onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
"""

However this does not happen on Firefox or Safari.
Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)


// put focus on the textfield and stupid explorer hack to move the
// caret to the end
target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
	"   if (el.createTextRange) { " +
	"     var v = el.value; var r = el.createTextRange(); " +
	"     r.moveStart('character', v.length); r.select(); } }");
target.focusComponent(editor);

However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.


// put focus on the textfield and stupid explorer hack to move the
// caret to the end
target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
	"   el.select(); " +
        " }");
target.focusComponent(editor);



  was:
The class Javadoc for AjaxEditableLabel says:
{quote}
onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
{quote}

However this does not happen on Firefox or Safari.
Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)

{code}
                // put focus on the textfield and stupid explorer hack to move the
		// caret to the end
		target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
			"   if (el.createTextRange) { " +
			"     var v = el.value; var r = el.createTextRange(); " +
			"     r.moveStart('character', v.length); r.select(); } }");
		target.focusComponent(editor);
{code}

However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.

{code}
                // put focus on the textfield and stupid explorer hack to move the
		// caret to the end
		target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
			"   el.select(); " +
                        " }");
		target.focusComponent(editor);
{code}


    
> AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-4529
>                 URL: https://issues.apache.org/jira/browse/WICKET-4529
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.5.5
>         Environment: MacOS
>            Reporter: Erwin Bolwidt
>
> The class Javadoc for AjaxEditableLabel says:
> """
> onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
> """
> However this does not happen on Firefox or Safari.
> Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   if (el.createTextRange) { " +
> 	"     var v = el.value; var r = el.createTextRange(); " +
> 	"     r.moveStart('character', v.length); r.select(); } }");
> target.focusComponent(editor);
> However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
> I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   el.select(); " +
>         " }");
> target.focusComponent(editor);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (WICKET-4529) AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5

Posted by "Martin Grigorov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-4529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274264#comment-13274264 ] 

Martin Grigorov commented on WICKET-4529:
-----------------------------------------

Thanks for testing this, Andrea!

Yes, I used Firebug for Firefox and Dev tools for IE/Chrome/Safari, and Dragonfly for Opera.
All behaved well but Firefox.

I'll try your approach and if everything is OK then I'll apply it.
                
> AjaxEditableLabel not selecting text or moving cursor on Firefox 11.0 or Safari 5.0.5
> -------------------------------------------------------------------------------------
>
>                 Key: WICKET-4529
>                 URL: https://issues.apache.org/jira/browse/WICKET-4529
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.5.5
>         Environment: MacOS
>            Reporter: Erwin Bolwidt
>
> The class Javadoc for AjaxEditableLabel says:
> """
> onEdit(AjaxRequestTarget) is called when the label is clicked and the editor is to be displayed. The default implementation switches the label for the editor and places the caret at the end of the text.</li>
> """
> However this does not happen on Firefox or Safari.
> Looking at the code, it is actually trying to place the caret at the end of the line _and_ selecting the text in the form field. (This -selecting the text- is what I also want, and also the most common behavior of such ajax-editable fields on other big websites on the Internet)
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   if (el.createTextRange) { " +
> 	"     var v = el.value; var r = el.createTextRange(); " +
> 	"     r.moveStart('character', v.length); r.select(); } }");
> target.focusComponent(editor);
> However the "stupid explorer hack" as the code calls it, probably _only_ works on explorer, because the el.createTextRange method is quite old and deprecated (it's only needed on MSIE <9)
> I'm getting good results by just calling select() on the DOM element. I don't have MSIE available to test there but I think it will work there too.
> // put focus on the textfield and stupid explorer hack to move the
> // caret to the end
> target.appendJavaScript("{ var el=wicketGet('" + editor.getMarkupId() + "');" +
> 	"   el.select(); " +
>         " }");
> target.focusComponent(editor);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira