Skip to content

Fix #3354 Adding access key to suggested actions#3367

Merged
compulim merged 16 commits intomicrosoft:masterfrom
compulim:fix-3354-suggested-actions-access-key
Aug 1, 2020
Merged

Fix #3354 Adding access key to suggested actions#3367
compulim merged 16 commits intomicrosoft:masterfrom
compulim:fix-3354-suggested-actions-access-key

Conversation

@compulim
Copy link
Copy Markdown
Contributor

@compulim compulim commented Jul 30, 2020

Fixes #3354.

Changelog Entry

Added

  • Resolves #3354. Added access key (ALT + SHIFT + A for Windows and CTRL + OPTION + A for Mac) to suggested actions, by @compulim, in PR #3367

Description

Adding access key to suggested actions. Screen reader texts are updated to reflect this change.

Instead of using HTML's accesskey attribute, we are using our own implementation for a few reasons:

  • Cross platform consistency
  • Access key is only available when the focus is inside Web Chat component

Specific Changes

  • Added new sub-component AccessKeySink to handle the sinking of keyup events related to access keys
    • Include useFocusAccessKeyEffect hook for handling access key for focusing
  • Added suggestedActionsAccessKey prop to <Composer>
  • Added internal useLocalizeAccessKey hook to localize access key into string
  • Added internal useNavigatorPlatform hook to identify platform
    • Different platform prefer different access key modifiers
  • Updated en-US.json and yue.json for new loc strings

Additional Context

__tests__/suggestedActions.js

One of the original snapshot for __tests__/suggestedActions.js is incorrect. It produce the following result when styleOptions is set to { suggestedActionLayout: 'stacked', suggestedActionsStackedHeight: 50 }.

We should not render wrong layout with default style options. We should also put some efforts to make sure devs can't mess up the UI too far.

image


  • Testing Added

@compulim compulim marked this pull request as ready for review July 30, 2020 08:39
@compulim compulim changed the title Fix 3354 Adding access key to suggested actions Fix #3354 Adding access key to suggested actions Jul 31, 2020
@tdurnford tdurnford self-assigned this Jul 31, 2020
Comment thread packages/component/src/Composer.js
Comment thread packages/component/src/Utils/AccessKeySink/useFocusAccessKeyEffect.js Outdated
Comment thread packages/component/src/Utils/AccessKeySink/useFocusAccessKeyEffect.js Outdated
Comment thread packages/component/src/Utils/AccessKeySink/internal/useContext.js Outdated
Comment thread packages/component/src/Utils/AccessKeySink/internal/useContext.js Outdated
Comment thread packages/component/src/Utils/AccessKeySink/Surface.js Outdated
@compulim compulim force-pushed the fix-3354-suggested-actions-access-key branch from 36db80e to 5d36368 Compare July 31, 2020 19:10
@compulim compulim merged commit 85b5b7d into microsoft:master Aug 1, 2020
@compulim compulim deleted the fix-3354-suggested-actions-access-key branch August 1, 2020 04:26
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.

OC: Make suggested actions more accessible through TAB keys or accesskey attribute

2 participants