The extension recognizes when the same element receives focus consecutively via the Tab key (or Shift + Tab) two times in a row. The context stores the last visited element and compares it with the one that receives focus next, allowing detection of when repeated focus on the same element occurs.
It was also necessary to extend the navigation test context to prevent it from ending prematurely in this scenario. However, a stopping condition was established: if the repeated focus on the same element does not exceed a fixed number of times (the defined constant is 5), since it could be a case where the test gets stuck on that element. The check consists of verifying at all times whether the last 5 elements that received focus are precisely the same element.
