Jupyter Notebook

How to Fix Tab Is Not Working on Visual Studio Codes Jupyter Notebook

While working on a Jupyter Notebook on Visual Studio Code, you might suddenly find out that the β€œTab” key (of your keyboard) is not working as expected. Usually, the β€œTab” key indents a selected code block or a line of code. But Visual Studio has a feature called tab trapping that,when activated, the β€œTab” button moves its focus to the next UI element of the Visual Studio Code.

If the tab trapping feature is activated, you will see the β€œTab Moves Focus” indicator in the status bar of the Visual Studio Code as marked in the following screenshot:

To be able to indent the codes using the β€œTab” key again, you have to disable the Tab trapping feature of Visual Studio Code. To disable the Tab trapping feature of Visual Studio Code, press <Ctrl> + M.

Once the tab trapping feature is disabled, you will not see the β€œTab Moves Focus” indicator in the status menu of Visual Studio Code[1] and the β€œTab” key will indent the codes as usual[2].

A screenshot of a computer program Description automatically generated

Conclusion

The <Ctrl> + M toggles on/off the tab trapping feature of Visual Studio Code. The tab trapping feature is enabled if you press the <Ctrl> + M key combination while the feature is disabled. If you accidentally press this key combination, Tab trapping will be enabled and your β€œTab” key will not work as expected – will not indent the codes. So, if you want to indent the codes with the β€œTab” key as usual, all you have to do is press the <Ctrl> + M key combination again to toggle off the tab trapping feature of Visual Studio Code.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.