Skip to content

fix(react-list): fix useList and useListItem as prop handling#36026

Open
dmytrokirpa wants to merge 4 commits intomicrosoft:masterfrom
dmytrokirpa:test/list-base-hooks
Open

fix(react-list): fix useList and useListItem as prop handling#36026
dmytrokirpa wants to merge 4 commits intomicrosoft:masterfrom
dmytrokirpa:test/list-base-hooks

Conversation

@dmytrokirpa
Copy link
Copy Markdown
Contributor

Summary

Companion to #35821. Isolates the hook-level test additions as a master-passing baseline, plus fixes an operator precedence bug that would have silently broken the as prop when props.as is explicitly set.

  • Commit 1 — fixes operator precedence in useList_unstable and useListItem_unstable: props.as || navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE was parsed as (props.as || navigationMode === 'composite') ? 'div' : DEFAULT_ROOT_EL_TYPE, meaning a truthy props.as always resolved to 'div'.
  • Commit 2 — adds baseline tests for useList_unstable and useListItem_unstable:
    • Default state: role, root element, no selection
    • Selection mode: listbox/option roles, toggle via Space key, onSelectionChange callback
    • Composite navigation mode: div root, grid/row roles
    • Explicit as prop override (also serves as a regression test for the precedence fix)

Why

These tests are useful independent of #35821 — they pin existing behavior so that the refactor in #35821 (which introduces useListBase_unstable and useListItemBase_unstable and delegates the original hooks to them) produces a reviewable diff. Any assertion that needs updating there surfaces a behavior change worth discussing.

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.3 MB
325.038 kB
1.301 MB
325.039 kB
4 B
1 B
react-list
List
87.128 kB
25.767 kB
87.13 kB
25.767 kB
2 B
react-list
ListItem
111.036 kB
32.683 kB
111.038 kB
32.684 kB
2 B
1 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
70.415 kB
19.963 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.205 kB
68.894 kB
react-components
react-components: FluentProvider & webLightTheme
43.63 kB
14.026 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
108.995 kB
36.042 kB
🤖 This report was generated against 70972f1b1169ae00247b080202ce05581c2dd62f

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

@dmytrokirpa dmytrokirpa force-pushed the test/list-base-hooks branch from 285558f to 4c11090 Compare April 22, 2026 11:42
Comment thread change/@fluentui-react-list-b1d5584a-1533-4c65-96b4-988e2060b18f.json Outdated
@dmytrokirpa dmytrokirpa changed the title test(react-list): baseline hook tests + operator precedence fix as precondition for #35821 fix(react-list): fix useList and useListItem as prop handling Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants