Skip to content

Commit 8866e95

Browse files
uzirthapaclaude
andcommitted
fix: Remove tabIndex and focus CSS from AttachmentRow to avoid test failures
Reverted tabIndex={-1} on AttachmentRow and focus CSS on StackedLayout since they could interfere with existing focus traps and cause test failures. The core fix (aria-label derivation from text content in useRoleModEffect) is sufficient for screen readers to announce Adaptive Card content via browse mode. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2a1926d commit 8866e95

File tree

4 files changed

+11
-37
lines changed

4 files changed

+11
-37
lines changed

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,8 @@ Breaking changes in this release:
363363

364364
### Fixed
365365

366-
- Fixed screen reader (Narrator/NVDA) not announcing Adaptive Card content when focused in stacked layout, by [@uzirthapa](https://github.com/uzirthapa)
367-
- Made stacked layout attachment rows keyboard-focusable with `tabIndex={0}`
368-
- Added focus-visible styling for stacked attachment rows
369-
- Adaptive Cards without `speak` property now derive `aria-label` from visible text content
366+
- Fixed screen reader (Narrator/NVDA) not announcing Adaptive Card content in stacked layout, by [@uzirthapa](https://github.com/uzirthapa)
367+
- Adaptive Cards without `speak` property now derive `aria-label` from visible text content so screen readers can announce card content
370368
- Fixed [#5256](https://github.com/microsoft/BotFramework-WebChat/issues/5256). `styleOptions.maxMessageLength` should support any JavaScript number value including `Infinity`, by [@compulim](https://github.com/compulim), in PR [#5255](https://github.com/microsoft/BotFramework-WebChat/issues/pull/5255)
371369
- Fixes [#4965](https://github.com/microsoft/BotFramework-WebChat/issues/4965). Removed keyboard helper screen in [#5234](https://github.com/microsoft/BotFramework-WebChat/pull/5234), by [@amirmursal](https://github.com/amirmursal) and [@OEvgeny](https://github.com/OEvgeny)
372370
- Fixes [#5268](https://github.com/microsoft/BotFramework-WebChat/issues/5268). Concluded livestream is sealed and activities received afterwards are ignored, and `streamSequence` is not required in final activity, in PR [#5273](https://github.com/microsoft/BotFramework-WebChat/pull/5273), by [@compulim](https://github.com/compulim)

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

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,20 @@
5858

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

61-
// Both attachment rows should be programmatically focusable via tabIndex="-1".
61+
// Both attachment rows should exist with proper a11y attributes.
6262
expect(attachmentRows).toHaveProperty('length', 2);
63-
expect(attachmentRows[0].getAttribute('tabindex')).toBe('-1');
64-
expect(attachmentRows[1].getAttribute('tabindex')).toBe('-1');
65-
66-
// Both should have role="group".
6763
expect(attachmentRows[0].getAttribute('role')).toBe('group');
6864
expect(attachmentRows[1].getAttribute('role')).toBe('group');
6965

70-
// Focus on the first attachment row and verify it receives focus.
71-
attachmentRows[0].focus();
72-
73-
await pageConditions.became(
74-
'focus is on the first attachment row',
75-
() => document.activeElement === attachmentRows[0],
76-
1000
77-
);
66+
// The Adaptive Cards inside should have aria-labels derived from text content.
67+
const firstCard = attachmentRows[0].querySelector('.ac-adaptiveCard');
68+
const secondCard = attachmentRows[1].querySelector('.ac-adaptiveCard');
7869

79-
// The Adaptive Card inside should have an aria-label derived from text content.
80-
const card = attachmentRows[0].querySelector('.ac-adaptiveCard');
70+
expect(firstCard.getAttribute('aria-label')).toContain('First card content');
71+
expect(firstCard.getAttribute('role')).toBe('figure');
8172

82-
expect(card.getAttribute('aria-label')).toContain('First card content');
83-
expect(card.getAttribute('role')).toBeTruthy();
73+
expect(secondCard.getAttribute('aria-label')).toContain('Second card content');
74+
expect(secondCard.getAttribute('role')).toBe('figure');
8475
});
8576
</script>
8677
</body>

packages/component/src/Activity/AttachmentRow.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ function AttachmentRow(props: AttachmentRowProps) {
3535
const classNames = useStyles(styles);
3636

3737
return (
38-
<div
39-
aria-roledescription="attachment"
40-
className={classNames['stacked-layout__attachment-row']}
41-
role="group"
42-
tabIndex={-1}
43-
>
38+
<div aria-roledescription="attachment" className={classNames['stacked-layout__attachment-row']} role="group">
4439
<ScreenReaderText text={attachedAlt} />
4540
{showBubble ? (
4641
<Bubble

packages/component/src/Activity/StackedLayout.module.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@
5252
.stacked-layout__attachment-row {
5353
margin-block-start: var(--webchat__padding--regular);
5454
width: 100%;
55-
56-
&:focus {
57-
outline: 0;
58-
}
59-
60-
&:focus-visible {
61-
outline: var(--webchat__border-width--transcript-visual-keyboard-indicator)
62-
var(--webchat__border-style--transcript-visual-keyboard-indicator)
63-
var(--webchat__color--transcript-visual-keyboard-indicator);
64-
}
6555
}
6656

6757
&.stacked-layout--no-message .stacked-layout__attachment-list .stacked-layout__attachment-row:first-child {

0 commit comments

Comments
 (0)