# JSROOT disable keyboard event processing

**URL:** <https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201>\
**Category:** Newbie\
**Tags:** jsroot\
**Created:** [May 1, 2020, 9:02am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201 "2020-05-01T09:02:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![berserker](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/berserker/32/17693_2.png) [@berserker](https://root-forum.cern.ch/u/berserker)\
**Post date:** [May 1, 2020, 9:02am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/1 "2020-05-01T09:02:16Z")

</div>

Dear Experts!

When I export a Jupyter Notebook to HTML slides (see e.g. [1]) and navigate across slides using keyboard arrows or PgUp/PgDn etc., these keyboard events are also processed by JSROOT plots and screw them up. Is it possible to completely disable keyboard event processing by JSROOT?

[1] [https://rise.readthedocs.io/en/stable/\_images/basic\_usage.gif](https://rise.readthedocs.io/en/stable/_images/basic_usage.gif)

---

<div class="post-metadata">

**Author:** ![oshadura](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oshadura/32/14460_2.png) [@oshadura](https://root-forum.cern.ch/u/oshadura)\
**Post date:** [May 1, 2020, 10:52am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/2 "2020-05-01T10:52:40Z")

</div>

@linev can you please take a look when you will have time?

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [May 4, 2020, 8:36am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/3 "2020-05-04T08:36:10Z")

</div>

Hi,

Yes, this is known problem.  
I will try to provide reasonable solution.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [May 7, 2020, 12:20pm UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/4 "2020-05-07T12:20:48Z")

</div>

Hi,

After [PR #5567](https://github.com/root-project/root/pull/5567) problem should be fixed in master.  
Fix requires changes in JSROOT, which were applied before.  
Can you try current master version of ROOT?

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![berserker](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/berserker/32/17693_2.png) [@berserker](https://root-forum.cern.ch/u/berserker)\
**Post date:** [May 11, 2020, 8:32am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/5 "2020-05-11T08:32:08Z")

</div>

Hi,

> [@linev](#):
>
> Can you try current master version of ROOT?

I’ve added the line from the PR to `$ROOT_SYS/lib/JupyROOT/helpers/utils.py`.

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [May 11, 2020, 8:33am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/6 "2020-05-11T08:33:25Z")

</div>

Hi,

This line is not enough - you need latest JSROOT code as well.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![berserker](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/berserker/32/17693_2.png) [@berserker](https://root-forum.cern.ch/u/berserker)\
**Post date:** [May 11, 2020, 10:59am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/7 "2020-05-11T10:59:24Z")

</div>

> [@linev](#):
>
> This line is not enough - you need latest JSROOT code as well.

Hm. Why? Looks like plots stopped processing keyboard events at least in Jupyter Notebook.

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [May 11, 2020, 11:13am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/8 "2020-05-11T11:13:24Z")

</div>

> [@berserker](#):
>
> Hm. Why? Looks like plots stopped processing keyboard events at least in Jupyter Notebook.

It works if you are using ROOT master

---

<div class="post-metadata">

**Author:** ![berserker](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/berserker/32/17693_2.png) [@berserker](https://root-forum.cern.ch/u/berserker)\
**Post date:** [May 11, 2020, 11:26am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/9 "2020-05-11T11:26:24Z")

</div>

> [@linev](#):
>
> It works if you are using ROOT master

```auto
$ root --version
ROOT Version: 6.20/00
Built for linuxx8664gcc on Feb 26 2020, 16:40:17
From tags/v6-20-00@v6-20-00

```

I’ll try again and look why it appears to work.

---

<div class="post-metadata">

**Author:** ![berserker](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/berserker/32/17693_2.png) [@berserker](https://root-forum.cern.ch/u/berserker)\
**Post date:** [June 11, 2020, 10:22am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/10 "2020-06-11T10:22:51Z")

</div>

Ok, this is what I did to `$ROOT_SYS/lib/JupyROOT/helpers/utils.py`:

```auto
function requirejs_success(base_url) {{
    return function() {{
// require.config({{
// baseUrl: base_url + 'static/'
// }});
        display_{jsDivId}();
    }}
}}

function display_{jsDivId}() {{
    require(['https://root.cern/js/dev/scripts/JSRootCore.min'],
        function(Core) {{
            var obj = Core.JSONR_unref({jsonContent});
            Core.key_handling = false;
            Core.draw("{jsDivId}", obj, "{jsDrawOptions}");
        }}
    );
}}

```

and now it really seem to do what is expected.

Also, now I don’t need to start `notebook` with `--NotebookApp.extra_static_paths=[\"$ROOTSYS/js\"]`. Won’t this overload [https://root.cern/js/](https://root.cern/js/)?

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [June 11, 2020, 11:15am UTC](https://root-forum.cern.ch/t/jsroot-disable-keyboard-event-processing/39201/11 "2020-06-11T11:15:14Z")

</div>

Hi,

All necessary changes should be already in ROOT master branch and will be released with 6.22 version very soon.

> [@berserker](#):
>
> Also, now I don’t need to start `notebook` with `--NotebookApp.extra_static_paths=[\"$ROOTSYS/js\"]` .

This change was introduced to let use Jupyter notebooks without internet connection.  
But if your solution works - you can use it as well.

Regards,  
Sergey
