Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add useObserveTranscriptFocus hook and focus fix on IE11 #3755

Merged
merged 11 commits into from
Feb 24, 2021

Conversation

compulim
Copy link
Contributor

@compulim compulim commented Feb 24, 2021

Fixes #3754.

Changelog Entry

Added

Description

Added a new useObserveTranscriptFocus hook to allow apps to observe which elements in the transcript the user is focusing on.

Also added a focus redirection mechanism to fix an issue in IE11, excerpt from comment in code:

With an empty transcript, when the user clicks on the empty space (a.k.a. filler), IE11 says the focus is on the <div className="filler">, despite there are no "tabIndex" attributes set on the filler. We need to artificially send the focus back to the transcript.

Design

Today, Emulator has a mechanism to select/highlight a single activity.

Since Web Chat also introduced similar "transcript navigation" feature in PR #3703, Emulator can move to Web Chat official feature.

To enable that, we need to add an useObserveTranscriptFocus hook to let the app to know which activity is user is selecting.

Tomorrow, we can extend this hook by allowing the user to focus on attachments as well.

Specific Changes

  • Added a new useObserveTranscriptFocus hook, similar to existing useObserveScrollPosition hook
  • Updated BasicTranscript.js to emit transcript focus to its observers when the focus has changed
  • Added new tests for useObserveTranscriptFocus
  • To fix an issue in IE11, added a focus redirector for transcript filler
    • Filler is an empty <div> used to push the message bubbles to the bottom of the transcript initially
    • It has flex-grow: 1 and flex-shrink: 10000, that means, it is very likely to get shrunk and very unlikely to grow
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@compulim compulim added this to the R12 milestone Feb 24, 2021
@compulim compulim changed the title Add useObserveTranscriptFocus hook Add useObserveTranscriptFocus hook and focus fix on IE11 Feb 24, 2021
@compulim compulim marked this pull request as ready for review February 24, 2021 00:35
docs/HOOKS.md Outdated Show resolved Hide resolved
Copy link
Contributor

@corinagum corinagum left a comment

Choose a reason for hiding this comment

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

LGTM - pending comments

@compulim compulim merged commit ead34d4 into microsoft:master Feb 24, 2021
@compulim compulim deleted the feat-useobservetranscriptfocus branch February 24, 2021 18:54
@compulim compulim mentioned this pull request Mar 2, 2021
52 tasks
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.

Add useObserveTranscriptFocus hook
2 participants