Skip to content

fix: Tab order is inconsistent with ProfileMenu #4397

@thebarrettlo

Description

@thebarrettlo

🐛 Bug Report

The FluentProfileMenu component hard-codes a tabindex attribute value of 1 (see #4104), despite recommendations to only use 0 or -1.

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex

Image

When the FluentProfileMenu is used in a flex box, such as in a FluentStack component, the tab order becomes noticeable. For example, if the FluentProfileMenu is placed at the end of the flex box/stack and users tab "forward", the FluentProfileMenu will be focused first.

💻 Repro or Code Sample

<FluentStack Orientation=Orientation.Horizontal HorizontalGap=16 HorizontalAlignment=HorizontalAlignment.End VerticalAlignment=VerticalAlignment.Center>

    @* This will be focused SECOND *@
    <FluentAnchor Href="https://microsoft.com")
                  title="Focusable 0"
                  Target="_blank"
                  Appearance=Appearance.Hypertext>
        Focusable 0
    </FluentAnchor>

    @* This will be focused THIRD *@
    <FluentAnchor Href="https://github.com")
                  title="Focusable 1"
                  Target="_blank"
                  Appearance=Appearance.Hypertext>
        Focusable 1
    </FluentAnchor>

    @* This will be focused FOURTH *@
    <FluentAnchor Href="https://linkedin.com")
                  title="Focusable 2"
                  Target="_blank"
                  Appearance=Appearance.Hypertext>
        Focusable 2
    </FluentAnchor>

    @* This will be focused FIRST *@
    <FluentProfileMenu HeaderLabel="Microsoft"
                       Initials="BG"
                       FullName="Bill Gates"
                       EMail="[email protected]"
                       PopoverStyle="min-width: 330px;" />
</FluentStack>

🤔 Expected Behavior

FluentProfileMenu is focusable using tab but follows the visual and written order of focusable elements.

😯 Current Behavior

FluentProfileMenu is focused out of order from sibling elements--typically first.

💁 Possible Solution

Set tabindex in FluentProfileMenu to 0.

🔦 Context

Failed tab stop tests in Accessibility Insights for Web. Failures in these accessibility tests are non-compliant for Microsoft-developed UIs.

🌍 Your Environment

  • OS & Device: Windows on PC
  • Browser: Microsoft Edge
  • .NET 9 and Fluent UI Blazor library Version 4.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions