The European Commission has launched legal action against Hungary and Poland over "violations of fundamental rights" of LGBTQ people.