#10268 closed defect (fixed)
Clear and focus on dijit.Editor doesn't work in Webkit
Reported by: | chaitanya | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Editor | Version: | 1.4.0b |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
From the mail to the list:
In Webkit browsers, if I try to clear and bring focus back into the editing area of a dijit.Editor widget, the following code doesn't work (dojo toolkit 1.3.2):
editor.attr("value", ""); editor.focus();
This works in IE8 and Firefox though. I have to resort to this to get the desired behaviour:
editor.attr("value", " "); editor.placeCursorAtStart(); editor.focus();
I think this is a bug. In particular, I don't like the fact that I have extra whitespace space in the editor. How can I avoid adding that extra whitespace?
Also, editor.focus() seems to work in Webkit if it is not immediately preceded by editor.attr("value", "...").
Attachments (1)
Change History (11)
Changed 11 years ago by
Attachment: | editor.html added |
---|
comment:1 Changed 11 years ago by
Attached the testcase (editor.html).
The link "Clear and focus 1" calls the code above which is expected to work, but doesn't work in Webkit.
"Clear and focus 2" calls code which works on Webkit but adds an extra nbsp, besides needing to call placeCursorAtStart().
comment:2 Changed 11 years ago by
Owner: | set to Jared Jurkiewicz |
---|
comment:3 Changed 11 years ago by
It's strange because we already have this code in the editor, on 1.4:
// Use to avoid webkit problems where editor is disabled until the user clicks it if(!html && dojo.isWebkit){ html = " "; }
comment:4 Changed 11 years ago by
That's because there's a typo in there -- should be dojo.isWebKit (notice the capital K). :)
Still, even fixing that doesn't make it work. You still have to call placeCursorAtStart() to bring the focus back into the editor.
comment:5 Changed 11 years ago by
Fixing the typo works for me. The testfile works for both links and it focuses the editor properly and allows you to type.
I think you didn't clear your cache. :-)
I tested it on Google Chrome 3.0 and Safari 3.2.3 and have no issues once the typo was corrected.
The addition of the whitespace is currently necessary in order to allow focusing to work right.
comment:7 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:8 Changed 11 years ago by
Seems to work fine in trunk now (except for the extra space, of course). Thanks.
comment:9 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|
Testcase for clear and focus issue on Webkit