microsoft / microsoft/BotFramework-WebChat

[TODO] Better text alternatives computation for Markdown messages

Open
#3,923 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog feature-request technical-debt
Dominant language
HTML
Stars
1.8k
Forks
1.6k
Avg merge
22h 58m
Merged PRs (30d)
2

Description

Feature Request

Fix the TODO inside packages/component/src/Utils/activityAltText.ts:

/** Computes all text from a given HTML document as flattened array. This is best-effort. */
function htmlTextAlternatives(document: Document): string[] {
  // TODO: [P2] #3923 Revisit this logic with W3C standard, we could do a better text alternatives computation.
  //       For example, <abbr title="..."> is not computed.
  //       https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_name
  return walk<HTMLElement>(document, node => {
    const { nodeType, tagName, textContent } = node;

    if (nodeType === Node.TEXT_NODE) {
      return [textContent];
    } else if (tagName === 'IMG') {
      return [node.getAttribute('alt')];
    } else if (!HTML_INLINE_TAGS.includes(tagName)) {
      return ['\n'];
    }
  });
}

[feature-request]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/component/src/Utils/activityAltText.ts at htmlTextAlternatives and read the referenced W3C Accessible Name and Description Computation guidance. Compare the current walk logic with the standard, including the noted abbr title example, then use the existing activity text-alternative behavior to verify the computation is improved.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
accessibility
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.