Skip to content

Fix: Maximum stack exceeded error#847

Open
oliverfoster wants to merge 1 commit intomasterfrom
issue/831
Open

Fix: Maximum stack exceeded error#847
oliverfoster wants to merge 1 commit intomasterfrom
issue/831

Conversation

@oliverfoster
Copy link
Copy Markdown
Member

fixes #831

Cause

  1. When forcing focus onto an element with a11y.focus, the attributes [tabindex=0, data-a11y-force-focus=true] are added to the subject element, allowing elements which are not natively focus to receive focus. On blur when [tabindex=0] is removed, if the element is not natively focusable, such as a div[role=heading], then the focus is lost, causing a refocus.
  2. When clicking a label element in an mcq, refocus was being triggered as the label is not natively focusable and nothing in its ancestor stack is focusable.

Replication

When using trickle to move to the next question, where trickle focuses the next heading and a user subsequently clicks an mcq label, a refocus loop is created.

Fix

  • Only removing the [tabindex] from the div[role=heading] after focus is reassigned where the focus is on a different element.
  • Allow label clicks to be considered as valid, non-focusable clicks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Needs Reviewing

Development

Successfully merging this pull request may close these issues.

Recursive loop error when focusing elements

1 participant