JSROOT disable keyboard event processing

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

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

Hi,

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

Regards,
Sergey

Hi,

After PR #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

Hi,

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

Hi,

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

Regards,
Sergey

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

It works if you are using ROOT master

$ 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.

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

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/?

Hi,

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

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