Skip to content

Room list: add sections to shared components#32735

Merged
florianduros merged 16 commits intodevelopfrom
florianduros/section-shared-component
Mar 16, 2026
Merged

Room list: add sections to shared components#32735
florianduros merged 16 commits intodevelopfrom
florianduros/section-shared-component

Conversation

@florianduros
Copy link
Copy Markdown
Member

@florianduros florianduros commented Mar 5, 2026

Require #32566
Task #32452

This PR adds the sections to the room list components of shared components:

  • RoomListSectionHeaderView: new component for header of the sections
  • VirtualizedRoomListView: two modes are introduced:
    • FlatList using 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 pattern
    • GroupedList using GroupedVirtualizedList. Following the tree grid pattern and inspired by this example
  • RoomListItemView & RoomListItemAccessiblityWrapper: the item has different a11y attributes when using in a listbox in a treegrid, this logic is implemented in the wrapper.
  • The flat mode is forced in the room list view model in order to do the sections implementations in the store and in the vm in a separate PR. For the final user of EW, the room list is unchanged.
Screen.Recording.2026-03-11.at.10.57.27.mov

@florianduros florianduros force-pushed the florianduros/section-shared-component branch 2 times, most recently from d3b1eb3 to 0b7c24a Compare March 5, 2026 16:32
@florianduros florianduros changed the base branch from florianduros/grouped-virtuallist to develop March 5, 2026 16:59
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from 0b7c24a to a1521f6 Compare March 5, 2026 17:21
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from a1521f6 to 652efce Compare March 6, 2026 10:56
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from 652efce to d553fa4 Compare March 9, 2026 13:48
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from d553fa4 to 9e45576 Compare March 10, 2026 14:56
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from dace5cc to 2917d50 Compare March 10, 2026 15:40
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from 2917d50 to d46037e Compare March 10, 2026 15:47
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from d46037e to 57d4a3e Compare March 10, 2026 15:58
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from 238764b to 937d72e Compare March 10, 2026 16:32
@florianduros florianduros force-pushed the florianduros/section-shared-component branch from 9996aad to a9078e2 Compare March 13, 2026 10:33
"vite-plugin-node-polyfills/shims/process",
"react-virtuoso",
],
include: ["vite-plugin-node-polyfills/shims/buffer", "vite-plugin-node-polyfills/shims/process"],
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/** 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;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
getSectionViewModel: (sectionId: string) => RoomListSectionHeaderViewModel;
getSectionHeaderViewModel: (sectionId: string) => RoomListSectionHeaderViewModel;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable (and matches the class name)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in ea6c1b6

export * from "./rich-list/RichList";
export * from "./room-list/RoomListHeaderView";
export * from "./room-list/RoomListSearchView";
export * from "./room-list/RoomListSectionHeaderView";
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Export RoomListItemAccessiblityWrapper too

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 0c81d04

@florianduros florianduros marked this pull request as ready for review March 13, 2026 13:30
Copy link
Copy Markdown
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sonar just wants the imports merged

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in b9632ec

/** 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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable (and matches the class name)

);

/**
* Get the item component for a specific index
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could probably use just slightly updated comments for these specific methods

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in bae1f92

);

/**
* Get the item component for a specific index
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this one

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in bae1f92


const getHeaderKey = useCallback((header: string): string => {
return header;
}, []);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one doesn't feel as obviously correct as the above: will the headers be unique?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because we pass the section id as key. I added comment in bc93425

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I see, that wasn't obvious - thanks for the comment!

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.

2 participants