not receiving some keydown events

25 views
Skip to first unread message

matt richards

unread,
Aug 3, 2024, 7:12:09 PM8/3/24
to Ajax.org Cloud9 Editor (Ace)
some keydown events are not received, such as 'tab' and 'delete' maybe others, take the following source

<div id=editor style=height:300px></div>
<div id=output></div>
<script type=module>
      import ace from 'https://cdn.jsdelivr.net/npm/ace-builds/+esm';
      var editor                    = ace.edit('editor');
      editor.container.onkeydown    = e=>output.append(e.key);
</script>

many thanks, ace editor is an excellent work
    

Harutyun Amirjanyan

unread,
Aug 4, 2024, 4:42:01 AM8/4/24
to ace-d...@googlegroups.com
editor stops propagation of events that are handled. You can use capturing event listener to get these events before the editor

      editor.container.addEventListener("keydown", e=>output.append(e.key), true);
Reply all
Reply to author
Forward
0 new messages