Repository: napari/napari

Issue:
Using arrow keys to switch selected layer skips one layer
## 🐛 Bug

If a layer is selected and you press the up/down arrow keys, instead of switching to the next/previous layer, it will skip over one layer.

## To Reproduce

Open napari, create create a bunch of layers, select one of them and press `up` or `down`.

## Expected behavior

The adjacent layer should be selected.

## Environment
```yaml
napari: 0.4.9rc0
Platform: Linux-5.12.8-arch1-1-x86_64-with-glibc2.33
System: Arch Linux
Python: 3.9.5 (default, May 24 2021, 12:50:35) [GCC 11.1.0]
Qt: 5.15.2
PyQt5: 5.15.4
NumPy: 1.20.3
SciPy: 1.6.3
Dask: 2020.12.0
VisPy: 0.6.6

OpenGL:
- GL version: 4.6.0 NVIDIA 465.31
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1920x1080, scale 1.0
- screen 2: resolution 1920x1200, scale 1.0

Plugins:
- animation: 0.0.2
- console: 0.0.3
- mrcfile-reader: 0.1.2
- napari-em-reader: 0.1.0
- napari-properties-plotter: 0.1.dev2+g2734460.d20210520
- ndtiffs: 0.1.1
- scikit-image: 0.4.8
- svg: 0.1.5
```


Discussion:
I noticed this too recently... I feel like it wasn't this way when the new layerlist got introduced.  will investigate.  thanks
git bisect puts it at #2612
looks like it was probably a merge error... all of the `select_layer_above`, `selected_layer_below` keybindings that got removed in [2493](https://github.com/napari/napari/pull/2493/files#diff-bba32f24d9521c1fd114e940534c88a661d3f3400db6c153ba296cc4f2a866b3) got added back in #2612 ... so now a keypress is triggering the action twice.

The easy fix is to just remove them again... but it might be worth having another quick conversation about "who controls" the key bindings on the layer list.  We had this conversation [previously](https://github.com/napari/napari/pull/2493#pullrequestreview-625733709) and chose to let Qt handle the standard up/down/delete/select_all behavior in the layer list, dropping the global scope of those keybindings.

CC @sofroniewn, @goanpeca, @Carreau ... what do you guys think?  Stay with what we decided in https://github.com/napari/napari/pull/2493#pullrequestreview-625733709, or tell QtLayerList to stop listening to key presses and pass them up to the viewer for them to be handled globaly?
> CC @sofroniewn, @goanpeca, @Carreau ... what do you guys think? Stay with what we decided in #2493 (review), or tell QtLayerList to stop listening to key presses and pass them up to the viewer for them to be handled globaly?

As an immediate fix I'd be fine dropping them again - I don't think we would have implemented our own if we'd had the ability to use "native" Qt ones. But now that the general keybinding stuff is progressing, maybe one day we will decide that no keybinding would ever natively be processed and every keybinding would flow through our stuff. Actually now that I think about it more, how far are we away from that? I guess there are sliders, layer list, comboboxes, menu items. Maybe one day none of them process their own key events and it's all configurable in the UI from #2826? I'd definitely love to hear more opinions here too!!

Resolving patch:
diff --git a/napari/components/_viewer_key_bindings.py b/napari/components/_viewer_key_bindings.py
--- a/napari/components/_viewer_key_bindings.py
+++ b/napari/components/_viewer_key_bindings.py
@@ -107,41 +107,6 @@ def transpose_axes(viewer):
     viewer.dims._transpose()
 
 
-@register_viewer_action(trans._("Remove selected layers."))
-def remove_selected(viewer):
-    viewer.layers.remove_selected()
-
-
-@register_viewer_action(trans._("Selected all layers."))
-def select_all(viewer):
-    viewer.layers.select_all()
-
-
-@register_viewer_action(trans._("Remove all layers."))
-def remove_all_layers(viewer):
-    viewer.layers.clear()
-
-
-@register_viewer_action(trans._("Select layer above."))
-def select_layer_above(viewer):
-    viewer.layers.select_next()
-
-
-@register_viewer_action(trans._("Select layer below."))
-def select_layer_below(viewer):
-    viewer.layers.select_previous()
-
-
-@register_viewer_action(trans._("Also select layer above."))
-def also_select_layer_above(viewer):
-    viewer.layers.select_next(shift=True)
-
-
-@register_viewer_action(trans._("Also select layer below."))
-def also_select_layer_below(viewer):
-    viewer.layers.select_previous(shift=True)
-
-
 @register_viewer_action(trans._("Toggle grid mode."))
 def toggle_grid(viewer):
     viewer.grid.enabled = not viewer.grid.enabled
diff --git a/napari/utils/shortcuts.py b/napari/utils/shortcuts.py
--- a/napari/utils/shortcuts.py
+++ b/napari/utils/shortcuts.py
@@ -10,16 +10,6 @@
     'napari:focus_axes_down': ['Alt-Down'],
     'napari:roll_axes': ['Control-E'],
     'napari:transpose_axes': ['Control-T'],
-    'napari:remove_selected': ['Control-Backspace', 'Control-Delete'],
-    'napari:select_all': ['Control-A'],
-    'napari:remove_all_layers': [
-        'Control-Shift-Backspace',
-        'Control-Shift-Delete',
-    ],
-    'napari:select_layer_above': ['Up'],
-    'napari:select_layer_below': ['Down'],
-    'napari:also_select_layer_above': ['Shift-Up'],
-    'napari:also_select_layer_below': ['Shift-Down'],
     'napari:toggle_grid': ['Control-G'],
     'napari:toggle_selected_visibility': ['V'],
 }


Test patch:
diff --git a/napari/_tests/test_viewer.py b/napari/_tests/test_viewer.py
--- a/napari/_tests/test_viewer.py
+++ b/napari/_tests/test_viewer.py
@@ -21,7 +21,7 @@ def _get_all_keybinding_methods(type_):
 
 
 viewer_methods = _get_all_keybinding_methods(Viewer)
-EXPECTED_NUMBER_OF_VIEWER_METHODS = 19
+EXPECTED_NUMBER_OF_VIEWER_METHODS = 12
 
 
 def test_len_methods_viewer(make_napari_viewer):