Proposed fix for issue #317 (Action firing twice on CPTextField in Firefox)

10 views
Skip to first unread message

Saikat Chakrabarti

unread,
Oct 31, 2009, 9:32:44 PM10/31/09
to objecti...@googlegroups.com
The problem here was that Firefox counts a return as a keyPress, while
safari does not, so calling keyPress in keyDown when return was being
hit was causing the keypress for return to happen twice in firefox.
So I added a check to make sure keyPress wasn't already called.

I also changed keyUp to only be called explicitly from the keyPress
method when the key is not a return or a tab. However, why is this
call even necessary? Is there some case where a user can type
something and keyPress fires but keyUp does not fire anyway? If that
is the case, then the fix I am making won't work, since I reset the
CPKeyDidPress value in the keyUp function. But right now, on each key
event in a CPTextField, keyUp gets fired twice (unless it's a return
or tab because of the change I just put in there). So it seems like
that explicit call to keyUp should be removed entirely?

Anyway, solution here:
http://github.com/saikat/cappuccino/commit/90811a43efc3b90e8a5d198c11555cc086a91e46

Code i was using to test it here: http://gist.github.com/223352

Tested in Safari 4 and Firefox 3.5.

Ross Boucher

unread,
Nov 1, 2009, 2:57:03 PM11/1/09
to objecti...@googlegroups.com
Did you run this in Internet explorer?

Saikat Chakrabarti

unread,
Nov 1, 2009, 3:35:37 PM11/1/09
to objecti...@googlegroups.com
I don't have access to internet explorer unfortunately =/. Can
someone try it out for me? I'm going to try to get a copy of WinXP
sometime this week.
Reply all
Reply to author
Forward
0 new messages