How to make a cell go from the white state to the grey state?

I’ve tried:

NotebookPanel#content.widgets[0].node.blur();
NotebookPanel#content.widgets[0].editorWidget.node.blur(); 
(NotebookPanel#content.widgets[0].editorWidget.editor as CodeMirrorEditor).blur();

This is an example of the two states that I am referring to:
image

Have you tried focusing on the notebook widget instead of using blur?. This is due a refactor because the current implementation is not accessible so I would not rely on this behaviour for long (see Improve tab navigation for notebook by krassowski · Pull Request #10889 · jupyterlab/jupyterlab · GitHub)

Focusing on the widget didn’t have an observable effect. Focusing on it’s editor turns it white.

It looks like pressing the down arrow causes the previously focused cell to turn grey. I will try to find that part of the code next week in order to see how it’s done.

EDIT:

Focusing on the Notebook does in fact cause the effect.

I’m pretty sure this is the code which gets modified in the pull request I linked, so that would be a good starting point :wink:

The tricky thing is that it uses focusIn and focusOut and requires proper target/relatedTarget. I still think that some form of focus/blur event on the notebook level should solve this, but indeed it might not be as trivial as I thought.

NotebookPanel#content.node.focus() does in fact cause the effect. Thank you.

1 Like