I’ve made a prototype in which the user can press the Escape key to close a dialog.
Depending how the dialog was opened (a variable is used for this), the prototype should jump to one of two pages within the prototype.
I’ve made a Is Condition with {Current_Key_Code} == 27 but in Chrome it seems that this is ignored. No matter what, the prototype always jumps to a certain page.
If I change it to {Current_Key_Code} == 28, the Escape key still jumps to a certain page.
It works fine in IE8.
(I prefer Chrome…)
8 answers
{Current_Key_Code} == 27 should be the correct condition for Escape key capture, I just tried it and it worked in both IE and Chrome…
Maybe I misunderstood what you mean. If you could send me the plot file, I can help you to check.
I’ve been trying different things, but the prototype keeps working differently in IE8 and Chrome…
In IE8 it actually behaves as I expect, but in Chrome, there is some issue with using Current_Key_Code.
I’ll send you the rather complex prototype and try to explain how to recreate it… 🙂
Thanks for feedback via e-mail. It was new to me, that the “Key Down” action is global and therefore activated from anywhere in the prototype. I’ve placed the same “Key Down” action (27 = Escape) on three different pages, and they were all activated when I pressed Escape in simulation.
As a consequence I’ve tried adding another condition, but I can’t make it work (tried both IE8 and Crhome). What am I doing wrong?
Nothing happens when I press Escape. I’ve tried putting a “Show Message” on both levels and the mesage after the first condition is shown, but the code somehow stops, because the message after the second condition never appears.
I’ve checked the names of the two pages, and the title of the page is “viewer” and the title of the page I wan’t to go to is “int-detail”.
Hi Ulrich, I haven’t tried yet but I think you should add two quotation marks to wrap the “viewer” string.
Both formats below should be ok:
{Current_Page_Title} == “viewer”
OR
{Current_Page_Title} == ‘viewer’
Please let me know if it solve your problem.
{Current_Page_Title} == ‘viewer’ works fine in IE8
{Current_Page_Title} == “viewer” works in IE8 but there is a “Error on page” in the IE8 status bar.
None of them work in Chrome.
Using {Current_Page_Title} == ‘viewer’ should be ok, just make sure you have add the condition checking under each key code checking.
I’ve sent you the email with a fixed version of the plot file.
The problem is solved. Here’s the summary:
1) Keyboard events are “Global”. If you define a keyboard event handler, it will be invoked when the keyboard event is triggered, no matter whether the handler is defined in the current active page.
2) If you process a keyboard event (e.g. ESC Key Down) in several handlers, all these handlers will be invoked when the event is triggered. The order to invoke handlers may vary according to the web browser.
Suggestion: It is not recommended to process the same keyboard event in multiple handlers, since they may affect each other and cause some strange behavior. A good habit would be: only define one handler for one specific keyboard event.
This question is now closed