Skip to content

Announce new lines inserted with Enter - #3427

Open
Bryan Valverde U (BryanValverdeU) wants to merge 3 commits into
masterfrom
u/bvalverde/announce-new-line-inserted
Open

Announce new lines inserted with Enter#3427
Bryan Valverde U (BryanValverdeU) wants to merge 3 commits into
masterfrom
u/bvalverde/announce-new-line-inserted

Conversation

@BryanValverdeU

@BryanValverdeU Bryan Valverde U (BryanValverdeU) commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix a screen reader accessibility issue where pressing Enter in the message body silently inserts a new line.

This change:

  • Adds a localized newLineInserted announcement string.
  • Announces "New line" after Enter successfully splits a paragraph.
  • Preserves compatibility with the legacy editor adapter, where this announcement is unsupported.
  • Adds unit tests for the paragraph announcement and legacy event conversion.

Issue

When composing a new message in Outlook, Narrator, NVDA, and JAWS remain silent after the user presses Enter in the message body. Users who rely on a screen reader do not receive confirmation that the insertion point moved to a new line.

Reproduction steps

  1. Open Outlook and sign in.
  2. Open the New Message dialog.
  3. Move focus to the message body and type text.
  4. Press Enter.
  5. Observe that the screen reader does not announce the newly inserted line.

Before this fix

The editor inserts a new line, but the screen reader remains silent.

After this fix

The editor announces "New line" after Enter successfully inserts a new paragraph.

User impact

This improves editing feedback for users with low vision or blindness who rely on Narrator, NVDA, or JAWS. It confirms that pressing Enter moved the insertion point to a new line rather than leaving the editor in an unknown state.

Accessibility

  • MAS: 1.3.1 - Info and Relationships
  • Trap ID: 1.4 - Uncomprehended Element
  • Reproduced in Outlook Production and Dogfood with Narrator, NVDA, and JAWS.

How to test

  1. Run yarn test:fast --testPathPattern="handleEnterOnParagraph|eventConverter".
  2. Run yarn test:fast.
  3. With a screen reader enabled, open an editor, type text in a paragraph, and press Enter.
  4. Verify that the screen reader announces "New line".

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0b3e8c6f-5223-4b6e-b959-5f8b209e5b10
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://microsoft.github.io/roosterjs/pr-preview/pr-3427/

Built to branch gh-pages at 2026-08-04 17:58 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0b3e8c6f-5223-4b6e-b959-5f8b209e5b10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an accessibility gap in the Content Model editing flow by providing an explicit screen-reader announcement when Enter splits a paragraph (inserting a new line/paragraph). It does so by introducing a new KnownAnnounceStrings key and wiring it into the paragraph-splitting edit step, while keeping the legacy editor adapter behavior unchanged by treating the new string as unsupported during event conversion.

Changes:

  • Add newLineInserted to KnownAnnounceStrings and demo announcement string mapping.
  • Set formatContext.announceData to announce newLineInserted when handleEnterOnParagraph successfully splits a paragraph.
  • Update legacy adapter event conversion to treat newLineInserted as unsupported, with unit tests covering this behavior and the paragraph announcement.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/roosterjs-editor-adapter/test/editor/utils/eventConverterTest.ts Adds a unit test ensuring unsupported announce strings (including newLineInserted) don’t surface in legacy getAnnounceData().
packages/roosterjs-editor-adapter/lib/editor/utils/eventConverter.ts Adds newLineInserted to the new→old known-announce-string map as unsupported (undefined).
packages/roosterjs-content-model-types/lib/parameter/AnnounceData.ts Extends KnownAnnounceStrings with the new newLineInserted key and documentation.
packages/roosterjs-content-model-plugins/test/edit/inputSteps/handleEnterOnParagraphTest.ts Adds test coverage verifying handleEnterOnParagraph sets formatContext.announceData to newLineInserted.
packages/roosterjs-content-model-plugins/lib/edit/inputSteps/handleEnterOnParagraph.ts Implements the announcement by setting formatContext.announceData after a successful paragraph split.
demo/scripts/controlsV2/mainPane/MainPane.tsx Adds demo string mapping so newLineInserted resolves to “New line”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants