The funny thing is I don't see the a.focus on my cypress code and Cypress still performs the click on the function that is failing, but then the test fails.
I just found a solution. I added
// returning false here prevents Cypress from // failing the test return false })
on the top of the spec as it is explained here Cypress Uncaught assertion