Skip to content

[Bug] Detailslist Getkey function not working #23614

Description

@okonech

Environment Information

FluentUI React 8.77.0

Describe the issue:

Sorting a detailslist containing items without a "key" property but with a passed getKey() function does not work the same as a detailslist containing items with a "key" property.

If a user selects multiple items for deletion for example, then sorts the list, different items are now selected and may incorrectly be deleted if the user proceeds.

Actual behavior:

With selections enabled (preferably multiple) select a few entries (first and third items) then sort by a column. Notice the selections are preserved by position (first and third items), even though the actual selected entries are now at different indexes.

Getkey bug

Expected behavior:

As with a detailslist containing "key" properties, the selections should follow the items as they are sorted.

Item key expected functionality

If applicable, please provide a codepen repro:

https://codepen.io/okonech/pen/XWZwNOL

This is a stripped down and slightly modified version of the detailslist example from https://developer.microsoft.com/en-us/fluentui#/controls/web/detailslist

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? (Yes, No)

Yes

Requested priority: (Blocking, High, Normal, Low)

Normal

Products/sites affected: (if applicable)

Azure portal. Workaround is to manually add a "key" property to items used in the list.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions