As reported in http://crbug.com/72588:
1. Go to http://jsfiddle.net/ZSt2d/1/
2. Focus the bordered <div> and press a key - it will not appear in the <div> as the onkeydown event prevents this (CORRECT)
3. Click the button under the <div>. Now you can press a key and the character will be put in the <div> because the onkeydown event is not fired (BAD). After one key is pressed, any more keys are suppressed again, until you press the button again, which results in the same procedure again.
Code from link is:
<div contenteditable="true" onkeydown="event.preventDefault();" style="border:1px solid black"></div>
<input type="button" value="Click me; then you are able to put one character in the div above me...">
No characters should appear in the contenteditable.
Also tested (on Mac 10.6):
WebKit nightly (r92303): FAIL
Chrome 15.0.843.0 canary: FAIL
Firefox 5.0.1: PASS
Opera 11.50: PASS
Looks like a regression because i have a little older build and I do not see the issue..will build the latest nightly and see.
(In reply to comment #1)
> Looks like a regression because i have a little older build and I do not see the issue..will build the latest nightly and see.
plz ignore this comment i was able to reproduce the issue. will analyse and get back
When clicking on the button, the input field loses focus ring, but insertion point keeps blinking. Bug 38546 might be tangentially related to such behavior.
Once again, I urge everyone to attach test cases, not link to outside sites. There are lots of bugs that have gone invalid due to remote links dying, and storing many reductions on a single outside site is particularly unfortunate.
I did put the reduction inline into the report. The jsfiddle link was intended as a convenience. Perhaps I should have reversed the order of their appearance to make this clearer.
Or did you mean create an attachment, and put the test case into the attachment? Personally I find that less convenient, but I'm happy to do it that way if that is the accepted way in the WebKit community (eg there are automated tools that can make use of attachments or somesuch).
In the function clearSelectionIfNeeded which is called whenever
focusednode is set, there is a check to see if the node is text or
input tag if it is none then it is not cleared--> pasted below comment
" // Don't clear the selection for contentEditable elements, but do
clear it for input and textarea. See bug 38696."
Since this is a contentEditable the clear is not called on it and
because of which the updateApperance is not called and hence the
cursor blinks and focus is not removed from the div.
I have added the s->clear irrespective of the tag and it fixes the issue.
If some one can comment on why the check for contenteditable is present i will try some other fix.
CC'ing Levi, who has a patch for bug 38696.
> If some one can comment on why the check for contenteditable is present i will try some other fix.
There are some things you can do to find it out:
1. "svn blame" command to see when this code was added.
2. Make a change and run regression tests to see what breaks.
This is probably a duplicate of the bug 38696.
Thanks Ryosuke - I hadn't considered that bug when I did a search before filing this bug (since its title mentions events are still received), but comment #4 on bug 38696 does say that the onkeydown event is *not* fired. Marking as dupe.
*** This bug has been marked as a duplicate of bug 38696 ***