Skip to content

fix(conversation-thread): target latest turn on prompt re-entry#6237

Open
TarunAdobe wants to merge 2 commits intomainfrom
ttomar/conversation-thread
Open

fix(conversation-thread): target latest turn on prompt re-entry#6237
TarunAdobe wants to merge 2 commits intomainfrom
ttomar/conversation-thread

Conversation

@TarunAdobe
Copy link
Copy Markdown
Contributor

Description

Updates swc-conversation-thread roving focus behavior so newly appended conversation turns become the next tab stop when focus is outside the thread. This lets users submit a prompt, wait for the generated response, and use Shift+Tab from the prompt field to return directly to the newest swc-conversation-turn without focus being moved while they are typing.

Also updates swc-conversation-turn accessibility semantics so the focused host element exposes role="group" and an accessible label such as “User message” or “System message”.

Motivation and context

Roving tabindex made it easy to move between turns with arrow keys, but the active tab stop could stay on a previously focused turn. After submitting a new prompt, Shift+Tab from the prompt field could return to an older turn instead of the newly generated response.

This change keeps focus stable while the user is in the prompt field, but updates the thread’s next re-entry target to the latest appended turn. It also ensures the element receiving roving focus has an accessible role and name.

Related issue(s)

  • fixes [Issue Number]

Screenshots (if appropriate)

N/A


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • swc-conversation-thread returns to the newest generated turn from the prompt field

    1. Open the Conversation thread full pattern story.
    2. Navigate between swc-conversation-turn elements with ArrowUp and ArrowDown.
    3. Press Tab to move focus to the prompt field.
    4. Submit a new prompt and wait for the generated response.
    5. Press Shift+Tab.
    6. Expect focus to land on the newly generated swc-conversation-turn.
  • RTI updates do not steal focus from the prompt field

    1. Open the Conversation thread full pattern story.
    2. Focus the prompt field.
    3. Submit a prompt and keep focus in the prompt area while the response is generated.
    4. Expect focus to remain in the prompt field while the new turn is appended.
    5. Press Shift+Tab.
    6. Expect focus to move to the newest conversation turn.

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Accessibility testing checklist

Required: Complete each applicable item and document your testing steps (replace the placeholders with your component-specific instructions).

  • Keyboard (required — document steps below) — What to test for: Focus order is logical; Tab reaches the component and all interactive descendants; Enter/Space activate where appropriate; arrow keys work for tabs, menus, sliders, etc.; no focus traps; Escape dismisses when applicable; focus indicator is visible.

    1. Open the Conversation thread story.
    2. Use Tab to enter the thread and ArrowUp / ArrowDown to move between turns.
    3. Use Home and End to jump to the first and last turn.
    4. Use Tab to move to the prompt field.
    5. Submit a prompt, wait for the response, then press Shift+Tab.
    6. Expect focus to return to the newest generated turn with a visible focus indicator.
  • Screen reader (required — document steps below) — What to test for: Role and name are announced correctly; state changes (e.g. expanded, selected) are announced; labels and relationships are clear; no unnecessary or duplicate announcements.

    1. Open the Conversation thread story with a screen reader enabled.
    2. Navigate to a user turn and a system turn.
    3. Expect each focused swc-conversation-turn to expose a group role and an accessible label such as “User message” or “System message”.
    4. Submit a prompt and wait for the generated response.
    5. Press Shift+Tab from the prompt field.
    6. Expect the newly generated turn to receive focus and be announced with its role/name and message content.

@TarunAdobe TarunAdobe requested a review from a team as a code owner May 7, 2026 06:34
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

⚠️ No Changeset found

Latest commit: cd65117

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@TarunAdobe TarunAdobe force-pushed the ttomar/conversation-thread branch from ec048ba to cd65117 Compare May 7, 2026 06:36
@TarunAdobe TarunAdobe self-assigned this May 7, 2026
@TarunAdobe TarunAdobe added the Status:Ready for review PR ready for review or re-review. label May 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

📚 Branch Preview Links

🔍 First Generation Visual Regression Test Results

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

Deployed to Azure Blob Storage: pr-6237

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

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

Labels

Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant