Skip to content

[Bug]: FluentProvider subtree permanently loses focus indicators #36809

Description

@herjotdhaliwal

Component

FluentProvider

Package version

 9.70.0

React version

18.3.1

Environment

System:
  OS: Windows 11 10.0.26200
Binaries:
  Node: 20.20.2
  Yarn: 1.22.22
  npm: 10.8.2
Browsers:
  Edge (Chromium): 153.0.4234.48
npmPackages:
  react: 16.14.0
  react-dom: 16.14.0
  @types/react: 17.0.43
  @types/react-dom: 16.9.24
  @fluentui/react-components: 9.70.0
  @fluentui/react-provider: 9.22.11
  @fluentui/react-tabster: 9.26.13
  @fluentui/react-link: 9.7.0
  @fluentui/react-button: 9.6.12
  keyborg: 2.6.0

Current Behavior

A FluentProvider can end up mounted with no focus-visible listener on its subtree at all. Every element inside it then takes real keyboard focus while keyborg is in keyboard-navigation mode, but never receives data-fui-focus-visible hence no focus indicator is ever drawn. It is permanent: no amount of tabbing restores it, and there is no warning.

In short, useFocusVisible binds the focus-visible polyfill once and never re-evaluates.

This occurs, when we are navigating from one service to another on redirect.

Potential cause here packages/react-components/react-tabster/src/hooks/useFocusVisible.ts.

Expected Behavior

Any element holding keyboard focus inside a mounted FluentProvider should receive data-fui-focus-visible and render a focus indicator, for the whole lifetime of that provider.

Reproduction

https://stackblitz.com/edit/qcbyxose-caieu9t2?file=src%2FApp.tsx

Steps to reproduce

  1. Open the reproduction and click into the preview pane.
  2. Tab through the "Control" row and the "Affected" row — both show focus rings, and the readout shows data-fui-focus-visible: YES.
  3. Click "Remove outer provider".
  4. Tab through the "Affected" row again.
  5. The readout confirms focus really moves onto each Link and the Button, but data-fui-focus-visible is never set and no focus ring is drawn. No further tabbing, clicking, or key press ever restores it.

Are you reporting an Accessibility issue?

yes

Suggested severity

High - No workaround

Products/sites affected

Account.live.com

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions