matchKey function with KeyPressed context.