Skip to content

[Utilities] getPreviousElement does not pass "tabbable" param to all places #6526

Description

@sophieH29

Reproduction of the bug in a codepen:

https://codepen.io/anon/pen/ePNjmo

Bug Report

  • Package version(s): 6.75.0
  • Browser and OS versions: Chrome, Mac OS

Priorities and help requested:

Are you willing to submit a PR to fix? Yes

Requested priority: Normal

Describe the issue:

Used FocusTrapZone, few elements inside have tabindex="0", others tabindex="-1", also data-is-focusable="true". I used data-is-focusable="true", as I have FocusZone inside FocusZoneTrap
When tabbing through Focus Trap Zone, lastTabbableElement is defined incorrectly what leads to tab out from trap.
Please, look at the bug reproduction here https://codepen.io/anon/pen/ePNjmo

Actual behavior:

It is possible to tab out from focus trap.

Expected behavior:

It is not possible to tab out from focus trap.

Fix

After investigating code, found out that getPreviousElement does not pass tabbable to all places, see https://github.com/OfficeDev/office-ui-fabric-react/blob/1b9405b3b64839975e16ee1fad04d7868d9e3b99/packages/utilities/src/focus.ts#L205

After trying to pass tabbable to that place, it fixed my issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions