π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(capture): recognize ARIA options as click targets
Hisam Fahri4fa9ee7f9aef
diff --git a/src/core/capture/dom/__tests__/element-utils.test.ts b/src/core/capture/dom/__tests__/element-utils.test.tsindex a5ef440..cd2ca5a 100644--- a/src/core/capture/dom/__tests__/element-utils.test.ts+++ b/src/core/capture/dom/__tests__/element-utils.test.ts@@ -156,6 +156,22 @@ describe('findFocusableAncestor', () => {expect(findFocusableAncestor(span)).toBe(button);button.remove();});++ it('resolves an ARIA option to itself rather than the tabIndex=-1 listbox wrapping it', () => {+ const list = document.createElement('div');+ list.setAttribute('role', 'listbox');+ list.tabIndex = -1;+ const option = document.createElement('div');+ option.setAttribute('role', 'option');+ const label = document.createElement('span');+ option.appendChild(label);+ list.appendChild(option);+ document.body.appendChild(list);++ expect(findFocusableAncestor(option)).toBe(option);+ expect(findFocusableAncestor(label)).toBe(option);+ list.remove();+ });});describe('getFieldLabel', () => {diff --git a/src/core/capture/dom/element-utils.ts b/src/core/capture/dom/element-utils.tsindex 2bce195..2bb6934 100644--- a/src/core/capture/dom/element-utils.ts+++ b/src/core/capture/dom/element-utils.ts@@ -1,5 +1,5 @@export const FOCUSABLE_SELECTOR =- 'a[href], button, input, select, textarea, [role="button"], [role="link"], [role="tab"], [role="menuitem"], [role="checkbox"], [role="radio"], [tabindex], [contenteditable="true"]';+ 'a[href], button, input, select, textarea, [role="button"], [role="link"], [role="tab"], [role="menuitem"], [role="checkbox"], [role="radio"], [role="option"], [tabindex], [contenteditable="true"]';const MAX_ELEMENT_RATIO = 0.8;