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

Focus trap in activity should stop trapping when activity no longer has tabbable elements #4264

Closed
compulim opened this issue Apr 27, 2022 · 0 comments · Fixed by #4265
Closed
Assignees
Labels
area-accessibility bug Indicates an unexpected problem or an unintended behavior.

Comments

@compulim
Copy link
Contributor

Screenshots

image

This screenshot shows document.activeElement pointing to a sentinel (a <FocusRedirector> created by the <FocusTrap>).

Version

4.15.1

Describe the bug

After the message content no longer contains any tabbable elements (say, card is disabled after submission), pressing TAB key should send the focus back to the chat history.

Steps to reproduce

  1. Navigate to https://microsoft.github.io/BotFramework-WebChat/05.custom-components/l.disable-adaptive-cards/index.html
  2. Use keyboard navigation keys to click on the "United States" button
  3. After the result is submitted, press TAB key and observe the focus ring is gone

Expected behavior

As both "United States" and "Hong Kong" button is disabled, pressing TAB key should send the focus back to the chat history.

Additional context

When the button is disabled, we must not send the focus elsewhere or blur. This is for accessibility reasons. Say, when a button is disabled, the focus should stay on the button until the user moved it away.

When disabling a button, currently, we are leaving the button enabled until the focus is moved away. Then, we set the button as disabled. We could do it better by setting the tabindex on the button as -1. Then, we will not need to observe the blur event on the button. We just need to leave the tabindex="-1" on the element.

[Bug]

@compulim compulim added bug Indicates an unexpected problem or an unintended behavior. Accessibility labels Apr 27, 2022
@compulim compulim self-assigned this Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-accessibility bug Indicates an unexpected problem or an unintended behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant