Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased][unreleased]

### Fixed
- accessibility: announce when the draft's quoted message and attachments change (as a result of user actions) (make it a live region) #4693


<a id="2_22_0"></a>

## [2.22.0] - 2025-10-17
Expand Down
26 changes: 23 additions & 3 deletions packages/frontend/src/components/composer/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,12 +535,32 @@ const Composer = forwardRef<
// (`id='chat-section-heading'`) is probably enough.
}
>
<div className='upper-bar'>
<section
// Keep in mind that this element also changes when switching
// between chats.
// We probably want such changes to be announced still.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I don't think so. This is confusing and useless when switching chats, switching chats can be considered a form of "navigation", thus we must not announce the changes.

I would like to refactor useDraft such that it returns loadingDraft, which we can then use to only apply aria-live when we have finished loading the draft initially.
But there is another MR pending which deals which moves useDraft to a separate file. Let's do this later to avoid conflicts.

aria-live='polite'
// Announce quote / editing / attachment _removals_
// as well as text changes and node insertions.
aria-relevant='all'
className='upper-bar'
>
{!messageEditing.isEditingModeActive ? (
<>
{draftState.quote !== null && (
<div className='attachment-quote-section is-quote'>
<Quote quote={draftState.quote} tabIndex={0} />
<div
// When changing the quoted message, e.g. with the Ctrl + Up
// shortcut, we should read the author's name
// even if it didn't change.
//
// Note that `aria-atomic` doesn't appear to work,
// at least with NVDA, when it's a _descendant_ of the
// `aria-live` element.
aria-atomic='true'
>
<Quote quote={draftState.quote} tabIndex={0} />
</div>
<CloseButton onClick={removeQuote} />
</div>
)}
Expand Down Expand Up @@ -605,7 +625,7 @@ const Composer = forwardRef<
/>
</div>
)}
</div>
</section>
<div className='lower-bar'>
{!messageEditing.isEditingModeActive && !recording && (
<MenuAttachment
Expand Down