diff --git a/resources/js/lib/commit-click.ts b/resources/js/lib/commit-click.ts index 7309fc79c..ddf5c3ffc 100644 --- a/resources/js/lib/commit-click.ts +++ b/resources/js/lib/commit-click.ts @@ -18,6 +18,10 @@ const interactiveSelector = [ '[role="checkbox"]', '[role="radio"]', '[role="menuitem"]', + '[role="switch"]', + '[role="tab"]', + '[role="slider"]', + '[role="combobox"]', ].join(', '); export type CommitClick = { diff --git a/tests/Unit/CommitClick.test.ts b/tests/Unit/CommitClick.test.ts index 61e7ee071..3bffaef9a 100644 --- a/tests/Unit/CommitClick.test.ts +++ b/tests/Unit/CommitClick.test.ts @@ -137,3 +137,14 @@ await test('deleted commits have no permalink to open', () => { assert.equal(clickedCommit(click(element(['p'], tombstone)), '', '/'), null); }); + +await test('accessible controls inside a commit do not navigate', () => { + for (const role of ['switch', 'tab', 'slider', 'combobox']) { + const control = element([`[role="${role}"]`], card); + assert.equal(clickedCommit(click(control), '', '/'), null); + assert.equal( + clickedCommit(click(element(['span'], control)), '', '/'), + null, + ); + } +});