Reduce complexity of the _onContainerKeydown method.