* Move ToastContext and utilities to shared components
* lint
* fix type
* cleanup
* fix broken test
* fix lint
* Add more tests for ToastContext
* Potential fix for pull request finding 'Unused variable, import, function or class'
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* feat:add missing methods to rls V3
* feat: use rls v3 methods instead of old alrgorithms
* feat: move stabel function to own utils
* feat: use this new moved functions
* test: cleaner test
* Don't re-export MainSplitContentType enum
I don't see why this was necessary, importing RoomView pulls in all sort
of stuff, whereas RoomContext is much smaller.
* ts, not tsx
* unintentional change
* Forward the scroller element and scroll handle through VirtualizedList
The room list needs two things the generic list did not expose: the underlying
scroll container (to observe which items are genuinely visible) and the imperative
scroll handle (to scroll an item into view). Forward an optional scrollerRef from
useVirtualizedList and pass scrollHandleRef through FlatVirtualizedList, mirroring
what GroupedVirtualizedList already exposes. Both are additive and optional, so other
consumers are unaffected.
Signed-off-by: David Langley <langley.dave@gmail.com>
* Add an unread-activity toast to the room list
Show a clickable "You have unread activity" pill when there are unread rooms
scrolled below the visible fold, including unreads hidden inside collapsed sections
whose header is below the fold. Clicking it scrolls the next such unread into view.
The visible fold is tracked with an IntersectionObserver over the rendered item
elements, so the toast appears as soon as a room crosses the fold rather than only
once it leaves Virtuoso's overscan buffer. The toast click is wired through an
imperative scroll handle the view registers with the view model.
Signed-off-by: David Langley <langley.dave@gmail.com>
* Change toast to target notifications only, not unread activity.
* Fix formatting and refresh Toast snapshots for compound-web 9.7.0
- Apply oxfmt to the room list view model and virtualized view.
- Refresh the RoomListToast/RoomListView story snapshots: compound-web
9.7.0 moves the typography classes onto the toast .content element and
rebuilds the Toast CSS module hashes.
- Add the missing UnreadActivityToast render snapshot baseline.
* Add e2e tests for the room list unread activity toast
Cover the unread-activity toast end to end:
- it appears for a notifying room scrolled below the fold and clicking it
scrolls that room into view (then the toast clears);
- a room with only an unread-activity dot (no notification count) does not
raise it;
- a collapsed section hiding a notifying room raises it, and clicking
scrolls the section header into view.
* Add visual snapshot baselines for the unread-activity toast stories
* Converge room-list toast codepaths into a single state-driven toast
Reviewer feedback: the unread-activity toast and the transient event toasts
(section_created / chat_moved) should share one mechanism, with toast
lifecycle and precedence owned by the view model rather than split across a
separate snapshot flag and a view-level ternary.
- RoomListViewModel now reconciles the transient event toast and the derived
unread-activity state into a single snapshot.toast via recomputeToast(); the
event toast still takes precedence and auto-dismisses, and the unread toast
reappears once it clears. Drops hasUnreadActivityBelow from the snapshot.
- RoomListView renders a single RoomListToast driven by snapshot.toast; the
ToastType union gains 'unread_activity'. The standalone UnreadActivityToast
component is folded into RoomListToast (clickable arrow-down variant).
- Adds VM tests for the unread-activity toast and the event/unread precedence.
* Pre-bundle the room-list dnd-kit + virtuoso graph in vitest browser mode
The room-list suites (RoomListView, VirtualizedRoomListView,
RoomListItemMoreOptionsMenu) import a heavy @dnd-kit + react-virtuoso graph.
Only @dnd-kit/abstract was pinned in optimizeDeps.include; @dnd-kit/dom,
@dnd-kit/react, @dnd-kit/abstract/modifiers and react-virtuoso were left to
runtime discovery. Under CI load the browser-mode dep optimizer can discover
them late, re-bundle and reload the page, which fails the in-flight
setupTests.ts import for those suites. Pinning the whole graph forces it into
the initial optimize pass so no re-run happens while tests load.
---------
Signed-off-by: David Langley <langley.dave@gmail.com>
* feat(rls): centralize room-list section ordering via getOrderedSections
Introduce a single source of truth for the ordered list of section
tags (defaults + custom) in section.ts. RoomListStoreV3 no longer
hard-codes the default tag order — it asks section.ts.
* feat(vm): add section reorder logic to RoomListStoreV3 and view model
* refactor(sc): extract RoomListSectionHeaderContent from RoomListSectionHeaderView
* feat(sc): add drag-and-drop reordering for room-list sections
* test(sc): update existing tests
* test: add new tests
* test(sc): add snapshot test for overlay
* test(e2e): add playright test for dnd of sections
* feat: tweak opacity
* fix: section detection when dragged
* feat: use relative position in section order
* chore: move style to room list section header view
* test: add e2e test for moving section before another
* feat: make favourite and low priority no draggable
* test: remove deprecated e2e test
* fix: type correctly dnd provider and hooks
* fix: use String instead of casting to string
* fix: wrong a11y attributes on section header
* test: fix keyboard navigation e2e tests
* feat: use custom a11y announcement for dnd
* fix: add aria-hidden to the overlay
* chore: remove duplicated code in a11Y announcement
* fix: increase keyboard drag offset
* fix: tests
* fix: virtuoso computed item key
* fix: aria-expanded double annoncement why dragging
* fix: re-add screen reader instructions
* chore: remove unused import
* fix: reduce keyboard drag offset
* fix: improve text readback on unread section
* feat: use a custom a11y plugin instead of buitin a11y plugin
* chore: formatting
* test: fix incorrect tests
* chore: use randomUUID
* fix: try to make test working
* fix: put back mock
* fix: circular import
* Revert "fix: circular import"
This reverts commit 6c69313ade.
* chore: add @dnd-kit/abstract to optimizeDeps.include
* test: fix e2e tests
* fix: disable interaction with section when dragging
* fix: be more explicit if the section will be dropped before or after
* fix: add info that space is dropping too
* fix: scroll to dropped section
* test: fix virtualized room list test
* chore: update lang
* chore: fix dead code analyze
* test: add provider section story
* fix: lang
* fix: again lang...
* fix: improve voice over on chrome
* test: upate snapshot
* fix: add readback when a section is over a non droppable element
* Fix long display / user names in UserMenu
And add a playwright test to assert (see playwright screenshot for
after photo).
* Dave installs the oxfmt extension
* snapshots
* Switch from prettier to oxfmt
* Make knip happy
* Make knip happy
* Apply suggestion from @t3chguy
* Rename .oxfmtrc.json to .oxfmtrc.jsonc
* Make oxfmt happier
* Add user status on user profile icon
Currently unstyled & no tests
* Style the user status icon
* Update snapshot
for avatar wrapper
* More snapshot updates
* add if braces
* Split out user status functions
to avoid circular dep which has the weird effect of just breaking
jest's mocking.
* type imports
* Update imports
* Update snapshot
* Tests
* baseline image
* Just snapshot the component itself
* User status in user menu
first pass, unstyled
* fix export
* superstylin'
* snapshots
* Add story & test
* Snapshots
and re-use the repeated rules
* Tests
* Fix jest lcov projectRoot config
* Change tooltip text to just 'clear'
* Add comment & fix console warn
* Remove all options screenshot
as it's not really particularly useful as a preset story
* remove stale screenshot
* fix imports
---------
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Use vitest for some EW unit tests
* Ensure library builds are done before unit tests
* Stabilise jest tests
* Move more tests over
* Make sonar happier
* Update types/node for happy-dom compat again
* Decrease max-workers to stabilise jest tests
* Split jest over 3 runners to alleviate memory woes
* Switch jest to runInBand
* Attempt to deflake jest tests
* tweak coverage
* tweak coverage
* fix: don't display the empty/collapse icon when the room list is empty
* Fix jest lcov projectRoot config
---------
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* First version of shared component
* Refactor as a functional component
* Add unit tests and more documentation
* Fix problem where wrappedRef was used by parent before assignment was performed.
* Use the shared component in app/web
* Clean up unused styling
* Added scrollbar-gutters as default styling in shared component
* Make sure the legacy mx_AutoHideScrollbar is set in app/web
* Updated snapshots
* Removing default style, scrollbar-gutter: stable;
* Updated snapshots
* useRef on wrapperRef to avoid loop in rendering
* scrollbar-width does not propagate
* Add AutoHideScrollbar to RoomListView
* Fix Prettier issue
* Updated snapshots
* Updated snapshot after merge
* Fix Sonar issue
* Limit width of the display name in user menu
Fixes https://github.com/element-hq/element-web/issues/33726
* Change js-sdk moduleNameMapper to apps/web (#33734)
Turns out the pnpm link has to be set to apps/web to actually work, so update the moduleNameMapper to look there too.
* update screenshots
* Update snapshot
* Update other snapshots
* Snapshot
* More snapshots
* Add user status on user profile icon
Currently unstyled & no tests
* Style the user status icon
* Update snapshot
for avatar wrapper
* More snapshot updates
* add if braces
* Split out user status functions
to avoid circular dep which has the weird effect of just breaking
jest's mocking.
* type imports
* Update imports
* Update snapshot
* Tests
* baseline image
* Just snapshot the component itself
---------
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* PoC Sign in with QR on new EW using generated QR for MSC4108 v2024
* Revert package.json changes
* Prettier
* Fix i18n
* Tidy up
* Remove unused state variable
* Iterate tests
* Partial revert
* Iterate
* Wire up qr_login route
* Iterate UI
* Fix React dev mode double rendering issue
* Fix react key warning
* Hide flow header on login
* Re-roll qr code on channel expiry
* Switch to AbortSignal
* Improve auto-retry QR UX
* Ensure we only show sign in with QR button if enabled
* XXX: enable labs flag on Netlify builds
* Tweak QR code sizing
* Move qr login flow into a dialog to match designs
* Fix null deviceId
* Remove duplicate log
* Iterate
* Fix tests
* Fix types
* Fix tests
* Fix tests
* Make Netlify more useful
* Make Netlify more useful v2
* Update copy
* Refactor QR link flow to use new SDK methods
Requires https://github.com/matrix-org/matrix-js-sdk/pull/5283
For element-hq/wat-internal#188
Split out from https://github.com/element-hq/element-web/pull/33184
* Link to js-sdk branch
* Update tests
* Simplify
* Revert js-sdk linking
* Iterate
* Iterate
* Refactor to handle most of the TODOs
* Remove unused code
* Remove unused code
* Use js-sdk isSignInWithQRAvailable API to simplify code
* Restore app-test.ts
* Improve coverage
* Improve coverage
* Remove unused prop/state
* Iterate
* Fix tests
* Iterate
* Tests
* Handle TODOs
* Docs
* Remove redundant call to crossSignDevice()
* Workaround to remove training slash on the serverName before auto-discovery
* Revert "Workaround to remove training slash on the serverName before auto-discovery"
This reverts commit 0335a8fdd1.
* setLoggedIn not to be used with OIDC flows as it clears storage
as per docs on setLoggedIn we should use restoreSessionFromStorage
* Don't show the security_code_prompt unconditionally(i.e. for the web logging in mobile flow)
* Update LoginWithQRFlow-test.tsx.snap
* Update MatrixChat-test from setLoggedInSpy to restoreSessionSpy
* Add todo for server switch
* Add todo about handling base URL or server name
* Handle server name or base URL being returned
* Format
* Fix loading state height
* Handle the homeserver URL differing during QR code login
* Comments
* Comments
* Register OIDC client ID after homeserver swap
* Make QrLoginDialog async to minimise the impact on bundle size
* Handle unsupported HS earlier in the flow
* Iterate
* Delint
* Fix test
* Discard changes to apps/web/element.io/develop/config.json
---------
Co-authored-by: Hugh Nimmo-Smith <hughns@element.io>
Co-authored-by: David Langley <langley.dave@gmail.com>
* Fix incoherent DeviceListener tests
* Re-order DeviceListenerCurrentDevice.recheck to reduce unnecessary work
* Introduce scopes in recheck to demonstrate which variables are shared
* Break recheck into separate functions
* Remove `onFocus` and `onBlur` handlers
react-resizable-panels fixed the issue where focus-visible was not
working as expected, so we no longer need this bit of code.
* Implement new hover/focus separator
* Collapse the panel when clicking on the new focus separator
* Remove `isFocusedViaKeyboard` from snapshot
* Update tests and storybook
* Expand panel only on double click
* Add animation
* Fix tests
* Don't render border when type is bar
* Single click to expand, double click to collapse
* Change focus separator color
* Support MSC4287 m.key_backup stable prefix as well as the unstable prefix
* Update comments to avoid talking about EX since this now applies more widely
* Make comments about m.key_backup more helpful
* Improve comment on recheckBackupDisabled
* Explicitly say backup is disabled only if enabled is actually set to false