Room list: add sections to shared components#32735
Conversation
d3b1eb3 to
0b7c24a
Compare
0b7c24a to
a1521f6
Compare
a1521f6 to
652efce
Compare
652efce to
d553fa4
Compare
d553fa4 to
9e45576
Compare
dace5cc to
2917d50
Compare
2917d50 to
d46037e
Compare
d46037e to
57d4a3e
Compare
238764b to
937d72e
Compare
This is an intermediary step before implementing sections in the vm. We force the flat list but we use the underneath the view supporting sections.
9996aad to
a9078e2
Compare
a9078e2 to
e4856f6
Compare
975cf24 to
25a342d
Compare
| "vite-plugin-node-polyfills/shims/process", | ||
| "react-virtuoso", | ||
| ], | ||
| include: ["vite-plugin-node-polyfills/shims/buffer", "vite-plugin-node-polyfills/shims/process"], |
There was a problem hiding this comment.
Added in 9fa8b34 which is making the tests fail https://github.com/element-hq/element-web/actions/runs/23046980040/job/66938460251
| /** Called when the visible range changes (virtualization API) */ | ||
| updateVisibleRooms: (startIndex: number, endIndex: number) => void; | ||
| /** Get view model for a specific section header (virtualization API) */ | ||
| getSectionViewModel: (sectionId: string) => RoomListSectionHeaderViewModel; |
There was a problem hiding this comment.
| getSectionViewModel: (sectionId: string) => RoomListSectionHeaderViewModel; | |
| getSectionHeaderViewModel: (sectionId: string) => RoomListSectionHeaderViewModel; |
There was a problem hiding this comment.
This seems reasonable (and matches the class name)
| export * from "./rich-list/RichList"; | ||
| export * from "./room-list/RoomListHeaderView"; | ||
| export * from "./room-list/RoomListSearchView"; | ||
| export * from "./room-list/RoomListSectionHeaderView"; |
There was a problem hiding this comment.
Export RoomListItemAccessiblityWrapper too
dbkr
left a comment
There was a problem hiding this comment.
Generally looks sensible though I think
|
|
||
| import React, { memo, type JSX, type FocusEvent } from "react"; | ||
| import { type MouseEventHandler } from "react"; | ||
| import ChevronRightIcon from "@vector-im/compound-design-tokens/assets/web/icons/chevron-right"; |
There was a problem hiding this comment.
sonar just wants the imports merged
| /** Called when the visible range changes (virtualization API) */ | ||
| updateVisibleRooms: (startIndex: number, endIndex: number) => void; | ||
| /** Get view model for a specific section header (virtualization API) */ | ||
| getSectionViewModel: (sectionId: string) => RoomListSectionHeaderViewModel; |
There was a problem hiding this comment.
This seems reasonable (and matches the class name)
| ); | ||
|
|
||
| /** | ||
| * Get the item component for a specific index |
There was a problem hiding this comment.
Could probably use just slightly updated comments for these specific methods
| ); | ||
|
|
||
| /** | ||
| * Get the item component for a specific index |
|
|
||
| const getHeaderKey = useCallback((header: string): string => { | ||
| return header; | ||
| }, []); |
There was a problem hiding this comment.
This one doesn't feel as obviously correct as the above: will the headers be unique?
There was a problem hiding this comment.
Yes because we pass the section id as key. I added comment in bc93425
There was a problem hiding this comment.
OK, I see, that wasn't obvious - thanks for the comment!
Require #32566
Task #32452
This PR adds the sections to the room list components of shared components:
RoomListSectionHeaderView: new component for header of the sectionsVirtualizedRoomListView: two modes are introduced:FlatVirtualizedList. In this mode the sections are flatten, it allows to keep the same API to pass the rooms in flat list (when no sections) or in grouped list. Following the listbox patternGroupedVirtualizedList. Following the tree grid pattern and inspired by this exampleRoomListItemView&RoomListItemAccessiblityWrapper: the item has different a11y attributes when using in alistboxin atreegrid, this logic is implemented in the wrapper.Screen.Recording.2026-03-11.at.10.57.27.mov