Re: [AJAX] custom control implementing IScriptControl : no key events notification in firefox



Hi Walter,

I made some progress on this issue. I finally found a workaround.
Please find below my comments.
[...]
You will find below the code of an html page that basically does what
the MS Ajax library is doing at init time using the DOM API.
As it is, it reproduces the behavior I have with MS js lib.

it's better with the code...
---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml"; >

<head>

<title>Untitled Page</title>

</head>

<body>

<script type="text/javascript">

function wireEventHandler(target, eventName, handler) {

var elt = document.getElementById(target);

if (elt.addEventListener) {

// Begin Firefox workaround

// *** Uncomment the line below to fix the issue ***

// elt.tabIndex = -1;

// End Firefox workaround

elt.addEventListener(eventName, handler, true);

}

}


function foo(e) {

alert('onkeydown: ' + e.target.id);

}

</script>

<input type="text" id="text" />

<div id="mydiv" style="width:100px;height:100px;background-color:blue"
</div>


<div style="left: 5px; width: 500px; position: absolute; top: 105px; height:
500px">

<div id="MyControl1"
style="background-color:red;position:relative;left:5px;top:5px;width:500px;height:500px;">

</div>

</div>

<script type="text/javascript">

wireEventHandler('MyControl1','keydown', foo);

</script>

</body>

</html>


.



Relevant Pages

  • Re: RFC: Building the Perfect Tabbed Pane (an tutorial article)
    ... so the fact that the Safari workaround breaks if cancelBubble is used ... var wrapHandler = function{ ... var listener = createListener(element, 'on'+eventType, ...
    (comp.lang.javascript)
  • Re: Safari preventDefault solved?
    ... I think there could be workarounds so that cancel bubble would still ... at least one DOM0 handler for the event ... It is the workaround. ...
    (comp.lang.javascript)
  • Re: Safari preventDefault solved?
    ... You lost me on the "user cannot cancel the bubble" point. ... at least one DOM0 handler for the event ... solution is to use legacy handlers for click and dblclick in so the ... It is the workaround. ...
    (comp.lang.javascript)
  • RE: Commit 34d76c41 causes linker errors on ia64 with NR_CPUS=4096
    ... handler too intrusive for -rc6, and should we rather go with my workaround ... and try to find something proper for 2.6.33? ... Using __alloc_percpurather than static declaration looks to be ...
    (Linux-Kernel)

Loading