Get selection from element context instead of using the global context