Commit Graph

231 Commits

Author SHA1 Message Date
Will Hunt 0ddc418cf9 Move ToastContext and utilities to shared components (#33949)
* 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>
2026-06-29 18:50:36 +00:00
Florian Duros aed2009b9f Room list: move sections out of labs to all the users (#33810)
* feat: remove section labs flag

* test: update tests

* feat: remove favourites and low prioriy filter in SC

* test: update screenshots

* test: update snapshots

* test: update playwright tests

* test: update playright screenshots

* test: update screenshot

* test: close release announcement

* test: fix skeleton screenshot

* test: fix sliding sync

* test: update room list tests

* test: update room list tests after section dnd

* test: update toast screenshot

* test: update again room list tests

* test: update screenshot
2026-06-29 16:30:27 +00:00
Richard van der Hoff d1e6bb5b52 Add "user identity" display to dev tools (#33977)
* Add "user identity" display to dev tools

* Correct incorect hard-coded string in test mock

* Fix up tests
2026-06-29 15:49:03 +00:00
Florian Duros c42899b0b1 Room list: remove usage of algorithms of old room list store (#33975)
* 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
2026-06-29 14:29:28 +00:00
Richard van der Hoff 0d3efa5fa7 Correct incorect hard-coded string in test mock (#34022) 2026-06-29 13:02:37 +00:00
David Baker c71f17e6de Don't re-export MainSplitContentType enum (#34021)
* 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
2026-06-29 12:58:52 +00:00
Florian Duros 526b4b8c33 Room list: remove usage of old room list store in LoggedInView & InviteDialog (#33973)
* feat: add functions to dm and server notice in rls

* feat: use these functions in dialogs to get rid of old rls
2026-06-29 11:46:14 +00:00
David Langley a0639bfc4b Add unread toast to room list sections (#33961)
* 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>
2026-06-29 08:55:26 +00:00
Florian Duros 1f83ba4bbb Room list: add drag and drop of sections to reorder them (#33606)
* 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
2026-06-26 10:00:44 +00:00
David Baker 4e3f47b948 Update to compound-web 9.6.0 (#33959)
* Update to compound-web 9.6.0

* Update snapshots

for aria-disabled change

* and this one
2026-06-25 16:05:58 +00:00
Michael Telatynski f9b97be1d7 Refactor languageHandler to avoid import cycles (#33948)
* Refactor languageHandler to avoid import cycles

Also move its tests to vitest

* Small refactor

* Iterate

* Iterate
2026-06-24 09:49:49 +00:00
Michael Telatynski a26732b040 Tidy up React JSX to make Sonar happier (#33946)
* Eradicate unused React props

* Fix unmatched defaultProps

* Remove spurious React fragments

* Remove unused JSX

* Remove unused React state field

* Remove unused React state field

* Update snapshots
2026-06-23 16:40:42 +00:00
Michael Telatynski 918f2932df Tidy languageHandler test (#33945)
Avoid using special test classes in favour of fetchMock
2026-06-23 11:25:34 +00:00
Michael Telatynski 1a3d5bbfff Fix double tooltip on collapsed Quick Settings button (#33923)
* Fix double tooltip on collapsed Quick Settings button

* Update snapshot
2026-06-22 10:31:48 +00:00
Michael Telatynski 45234b9c94 Migrate more jest tests to vitest (#33898)
* Migrate more jest tests to vitest

* Fix jest config

* Fix jest config

* Make remaining jest tests type-happy
2026-06-19 15:34:18 +00:00
Florian Duros 338c18df16 Room list: add release announcement for sections (#33800)
* feat: add release announcement for sections

* test: update screenshot

* test: update tests

* test: add release annoucement utils to close it

* test: close release announcement in custom section tests

* test: update release announcement e2e test

* test: add more tests

* feat: update Ra labels

* test: update screenshot

* chore: remove stale screenshot
2026-06-19 12:06:58 +00:00
David Baker 43b9bc9458 Fix long display / user names in UserMenu (#33900)
* 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
2026-06-19 11:14:57 +00:00
Michael Telatynski 7a1a3f518c Make codebase comply to knip --strict (#33893)
* Make codebase comply to `knip --strict`

Deletes a few bits of dead code

* Trim i18n strings

* Fix missing export

* Remove test of dead code
2026-06-18 09:35:47 +00:00
Michael Telatynski eca2f39dbb Switch from prettier to oxfmt (#33844)
* Switch from prettier to oxfmt

* Make knip happy

* Make knip happy

* Apply suggestion from @t3chguy

* Rename .oxfmtrc.json to .oxfmtrc.jsonc

* Make oxfmt happier
2026-06-16 12:17:18 +00:00
David Baker 3ab233940c User status in user menu (#33797)
* 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>
2026-06-16 09:01:34 +00:00
Florian Duros 1c8654e394 Room list: add notifications to section headers (#33826)
* feat(sc): add notification decoration to header

* feat(vm): add notification decoration to vm

* test(e2e): add test
2026-06-15 18:05:51 +00:00
Michael Telatynski 2f4e6a4ec4 Use vitest for some EW unit tests (#33816)
* 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
2026-06-15 13:24:33 +00:00
Michael Telatynski 7949980a7e Apply html utils sanitiser to embedded page (#33842)
* Apply html utils sanitiser to embedded page

* Write tests
2026-06-15 12:58:56 +00:00
Zack 0f0f8c6ba2 Refactor UnreadNotificationBadge to shared MVVM view (#33672)
* Refactor notification badge to shared MVVM view

* Bage icons Images

* Narrow unread notification badge refactor scope

* Align unread badge MVVM pattern

* Reduce unread badge viewmodel duplication

* Document unread badge viewmodel props

* Remove legacy badge classes from shared view

* Update css for knocked door

* Update thread badge e2e selector

* Update read receipt badge e2e selectors
2026-06-15 10:20:27 +00:00
Florian Duros add7d4c405 Room list: hide the empty/collapse icon when the room list is empty (#33814)
* 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>
2026-06-11 13:01:32 +00:00
Florian Duros 2d434c72d4 feat: remove logic to expand a section when a filter is selected (#33785) 2026-06-11 09:21:30 +00:00
rbondesson a8f9c75fc1 Make EventTileViewModel consume pure render data (#33805) 2026-06-11 08:05:43 +00:00
rbondesson 8a21fdb127 Move the AutoHideScrollbar to shared components (#33777)
* 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
2026-06-11 07:08:24 +00:00
Michael Telatynski 50035ce07e Merge pull request #33776 from element-hq/t3chguy/merge-modules
Absorb element-modules into monorepo
2026-06-10 10:10:03 +00:00
David Baker 9b6fe3f867 Merge pull request #33764 from element-hq/dbkr/withpresence_use_new_component
Make presence icons & colours consistent throughout the app
2026-06-09 14:04:34 +00:00
Michael Telatynski eaccc01687 Merge branch 'develop' of ssh://github.com/element-hq/element-web into t3chguy/merge-modules
# Conflicts:
#	pnpm-lock.yaml
#	pnpm-workspace.yaml
2026-06-09 12:39:57 +01:00
Will Hunt 925c762859 Disable URL previews per-message when the message provides a hint (#33775)
* Disable URL previews if the message requests it.

* Use MSC4095

* Expose type

* Document MSC

* cleanup

* cleanup
2026-06-09 10:40:41 +00:00
David Baker adedbe3206 snapshots 2026-06-09 11:10:16 +01:00
David Baker 6a40729137 Add tests for usePresence
and move the slightly weird test about it working when no member is linked
onto the hook test which is what it's actually trying to test.
2026-06-08 19:08:50 +01:00
David Baker 07974c7747 Move tooltip test up to PresenceIconView 2026-06-08 18:14:31 +01:00
Michael Telatynski af74f511ed Make tsc happier 2026-06-08 11:42:00 +01:00
David Baker d6a028da25 update snapshot 2026-06-08 11:23:27 +01:00
David Baker 2fa09e2939 Remove usage of the size prop.
You can have it any size you like as long as it's 8px.
2026-06-08 10:09:51 +01:00
David Baker 5ab5fa1e04 Limit width of the display name in user menu (#33746)
* 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
2026-06-05 09:49:28 +00:00
David Baker bb07f84e41 Add user status on user profile icon (#33653)
* 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>
2026-06-04 15:15:19 +00:00
Florian Duros f65a53a174 Room list: hide empty section when a filter is enabled (#33747)
* fix: hide empty section when a filter is enabled

* test: add unit tests
2026-06-04 14:40:56 +00:00
Michael Telatynski 486fa57b68 [Labs] Sign in with QR on new EW using generated QR for MSC4108 v2024 (#33184)
* 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>
2026-06-04 13:50:17 +00:00
Andy Balaam cb37bfcf36 Simplify and speed up DeviceListener (#33543)
* 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
2026-06-03 14:33:28 +00:00
R Midhun Suresh 2c8fafdec4 Implement new separator design (#33599)
* 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
2026-06-03 12:29:49 +00:00
Florian Duros 47f76c7d7a Update compound web and design tokens (#33698)
* chore: update comppound web and design tokens

* test: update snapshots

* test: update screenshots
2026-06-03 11:51:58 +00:00
Florian Duros f3a35127f6 fix: display compose menu when sections are enabled (#33725) 2026-06-03 10:22:27 +00:00
rbondesson 536fae63ea Refactor EventTile using the MVVM pattern - #8 (#33691)
* Make EventTileViewModel usage coherent

* Extract render helpers

* Extracted small render views

* Reduce Render Branch Duplication

* Clean Up Dead or Legacy Inline Code

* Add/Update documentation

* Updated snapshot

* Fix Sonar issue

* Updated snapshots after merge error

* Fix prettier issue
2026-06-03 06:20:59 +00:00
David Langley 2c6461db17 Remove resizer from fullscreen modules(like multiroom) (#33684)
* Fix multiroom with new resizer

* Fix multiroom with new resizer

* Add jest test

* Add if/else and comments
2026-06-02 14:10:46 +00:00
Andy Balaam 65b0ac8c28 Support MSC4287 m.key_backup stable prefix as well as the unstable prefix (#33034)
* 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
2026-06-02 10:25:03 +00:00
Zack 1c04814c2b Refactor EventPreview to shared MVVM (#33646)
* Refactor EventPreview to shared MVVM

* Fix EventPreviewView export formatting

* Snapshots images for stories

* Deduplicate event preview formatting

* Handle event preview update failures

* Coalesce event preview updates

* Wait for event preview test expectations
2026-06-02 08:36:28 +00:00