×
Namespaces

Variants
Actions
(Difference between revisions)

Key event handling in S60 Browser 7.1 and S60 WRT 1.1

From Nokia Developer Wiki
Jump to: navigation, search
Nokia Ron (Talk | contribs)
(Copied old and pasted in)
lpvalente (Talk | contribs)
m (Lpvalente - - Description)
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__
+
[[Category:Browser]][[Category:S60 3rd Edition FP2]][[Category:S60 5th Edition]][[Category:JavaScript]][[Category:Symbian Web Runtime]]
__NOEDITSECTION__
+
{{ArticleMetaData <!-- v1.2 -->
{{KBTS}}
+
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
{{KnowledgeBase
+
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|id=TSS001451
+
|devices= N86, E52, E55, E72, E75, 6710 Navigator, 6720 Classic, 6730 Classic, 5630 XpressMusic, 5730 XpressMusic, 5530 XpressMusic, N97
|platform=S60 3rd Edition FP2, S60 5th Edition
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|devices=N86, E52, E55, E72, E75, 6710 Navigator, 6720 Classic, 6730 Classic, 5630 XpressMusic, 5730 XpressMusic, 5530 XpressMusic, N97
+
|platform= S60 3rd Edition FP2, S60 5th Edition
|category=Browser, WRT
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|subcategory=key events
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
|creationdate=June 30, 2009
+
|signing= <!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|keywords=Browser, WRT, key events, Web Runtime, key navigation
+
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= Browser, WRT, key events, Web Runtime, key navigation
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090715
 +
|author= [[User:Nokia Ron]]
 +
<!-- The following are not in current metadata -->
 +
|subcategory= key events
 +
|id= TSS001451
 
}}
 
}}
  
[[Category:Browsing]][[Category:S60 3rd Edition, Feature Pack 2 ]][[Category:S60 5th Edition]][[Category:JavaScript]][[Category:Widget]]
+
 
  
 
==Overview==
 
==Overview==
There is a problem with key event triggering logic due to changes in the S60 Browser 7.1. This impacts browser and WRT developers, relying on navigation and selection key events as a part of their application logic.
+
{{Abstract|The S60 Browser and WRT (for widgets) have offered developers the ability to capture select and navigation key events using either onKeyPress or onClick, onKeyDown, and onKeyUp events.
 +
 
 +
Some early versions of S60 Browser 7.1, however, do not include an implementation for capturing onKeyPress events in either the browser or widgets. }}
  
 
== Description ==
 
== Description ==
The S60 Browser has undergone a major update in S60 5th Edition and the latest S60 3rd Edition FP2 devices.
+
S60 Browser 7.1, for S60 5th Edition and the latest S60 3rd Edition, Feature Pack 2 devices, has undergone a major update. This update involves adopting the WebKit core version 525. This new core introduces changes in the way key events are triggered and delegated to the DOM event handlers.
An update to the WebKit core introduces changes to how key events are triggered and delegated to the DOM event handlers.
+
  
This problem has been addressed in upcoming releases (browser 7.1.15679 onwards) but some devices have already shipped with the browser 7.1 (before browser 7.1.15679). This article shows how to create widgets that will work across browser versions.
+
During the implementation of the new version support for identifying key events with onKeyPress was accidentally omitted. This omission has been addressed in the browser version 7.1.15679 and onKeyPress support will be retained in future versions. However, some devices have already shipped with earlier versions of the browser. This article shows how to create widgets that will work across all browser versions.  
  
* '''Center (Selection key) now triggers mouse (onClick) events instead of key events (onPress)'''.
+
In summary, for 7.1 browsers earlier than version 7.1.15679:
* '''Navigation keys (left/right/up/down) now trigger key (onKeyDown, onKeyUp) events instead of onPress events'''.
+
* '''Centre (Selection key) triggers mouse (onClick) events only, key press events (onKeyPress) are not triggered. '''
 +
* '''Navigation keys (left/right/up/down) trigger key (onKeyDown and onKeyUp) events only, key press events (onKeyPress) are not triggered.'''
  
 
== Solution ==
 
== Solution ==
Developers relying on keypress events as a part of their navigation logic must '''migrate to monitoring keyDown/keyUp events for left/right/up/down keys and onClick events for the selection key'''.
+
Developers wanting to ensure that widget or website JavaScript code works on all versions of the S60 Browser should '''replace key press events monitoring with monitoring of onKeyDown and onKeyUp events for the left, right, up, and down keys and onClick events for the selection key'''.
  
 
===Code example - handling left/right/up/down key events===
 
===Code example - handling left/right/up/down key events===

Revision as of 19:47, 9 November 2012

Article Metadata
Tested with
Devices(s): N86, E52, E55, E72, E75, 6710 Navigator, 6720 Classic, 6730 Classic, 5630 XpressMusic, 5730 XpressMusic, 5530 XpressMusic, N97
Compatibility
Platform(s): S60 3rd Edition FP2, S60 5th Edition
S60 5th Edition
S60 3rd Edition FP2
Article
Keywords: Browser, WRT, key events, Web Runtime, key navigation
Created: Nokia Ron (15 Jul 2009)
Last edited: lpvalente (09 Nov 2012)


Contents

Overview

The S60 Browser and WRT (for widgets) have offered developers the ability to capture select and navigation key events using either onKeyPress or onClick, onKeyDown, and onKeyUp events.

Some early versions of S60 Browser 7.1, however, do not include an implementation for capturing onKeyPress events in either the browser or widgets.

Description

S60 Browser 7.1, for S60 5th Edition and the latest S60 3rd Edition, Feature Pack 2 devices, has undergone a major update. This update involves adopting the WebKit core version 525. This new core introduces changes in the way key events are triggered and delegated to the DOM event handlers.

During the implementation of the new version support for identifying key events with onKeyPress was accidentally omitted. This omission has been addressed in the browser version 7.1.15679 and onKeyPress support will be retained in future versions. However, some devices have already shipped with earlier versions of the browser. This article shows how to create widgets that will work across all browser versions.

In summary, for 7.1 browsers earlier than version 7.1.15679:

  • Centre (Selection key) triggers mouse (onClick) events only, key press events (onKeyPress) are not triggered.
  • Navigation keys (left/right/up/down) trigger key (onKeyDown and onKeyUp) events only, key press events (onKeyPress) are not triggered.

Solution

Developers wanting to ensure that widget or website JavaScript code works on all versions of the S60 Browser should replace key press events monitoring with monitoring of onKeyDown and onKeyUp events for the left, right, up, and down keys and onClick events for the selection key.

Code example - handling left/right/up/down key events

Old code

 document.onkeypress = function(event){
// add left/right/up/down keypress event handling code here
}

New code - migrate to this

 document.onkeydown = function(event){
// add left/right/up/down keydown event handling code here
}


Additionally, developers relying on key events from the selection key must migrate to monitoring the click event.

Code example - handling selection key events

Replace DOMelement with a reference to the DOM element you are monitoring.

Old code

 DOMelement.onkeypress = function(event){
// code for handling selection key events
}

New code - migrate to this

 DOMelement.onclick = function(event){
// add code for handling selection events
}
153 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×