Skip to content

Commit aaee156

Browse files
uzirthapaclaude
andcommitted
fix: Use tabIndex={-1} to avoid breaking focus traps in Adaptive Cards
tabIndex={0} added an extra tab stop inside the card's focus trap, causing SHIFT-TAB from card controls to land on the attachment row instead of the expected element. Using tabIndex={-1} makes the row programmatically focusable (for screen readers via virtual cursor) without adding it to the Tab order. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9a1279e commit aaee156

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

__tests__/html2/accessibility/adaptiveCard/attachmentRow.focusable.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858

5959
const attachmentRows = document.querySelectorAll('[aria-roledescription="attachment"]');
6060

61-
// Both attachment rows should be focusable via tabIndex.
61+
// Both attachment rows should be programmatically focusable via tabIndex="-1".
6262
expect(attachmentRows).toHaveProperty('length', 2);
63-
expect(attachmentRows[0].getAttribute('tabindex')).toBe('0');
64-
expect(attachmentRows[1].getAttribute('tabindex')).toBe('0');
63+
expect(attachmentRows[0].getAttribute('tabindex')).toBe('-1');
64+
expect(attachmentRows[1].getAttribute('tabindex')).toBe('-1');
6565

6666
// Both should have role="group".
6767
expect(attachmentRows[0].getAttribute('role')).toBe('group');

packages/component/src/Activity/AttachmentRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function AttachmentRow(props: AttachmentRowProps) {
3939
aria-roledescription="attachment"
4040
className={classNames['stacked-layout__attachment-row']}
4141
role="group"
42-
tabIndex={0}
42+
tabIndex={-1}
4343
>
4444
<ScreenReaderText text={attachedAlt} />
4545
{showBubble ? (

0 commit comments

Comments
 (0)