Skip to content

feat(web-pkg): allow following users in the yjs collaborators list - #3803

Merged
JammingBen merged 3 commits into
mainfrom
feat/yjs-collaborators-follow
Oct 20, 2026
Merged

JammingBen merged 3 commits into
mainfrom
feat/yjs-collaborators-follow

Conversation

@dschmidt

@dschmidt dschmidt commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

YjsCollaborators can now offer to follow another user in the session. It is opt-in: an app passes followingSupported and binds the followed user id with v-model:following. What following means (scroll position, viewport, cursor) stays with the app, the component only handles the UI and the state. Apps that don't pass followingSupported see no change.

 <YjsCollaborators
   :users="collaborators"
+  following-supported
+  v-model:following="followedUserId"
 />
  • The own user can't be followed, following set to the own id emits null.
  • If the followed user leaves the session, the component emits null, so the app stops following.
  • The followed user moves to the front of the avatar stack so they can't vanish into the +N overflow.
  • The toggle needs w-auto! p-1! because .oc-drop li button applies w-full, which squeezed the name to zero width.

Open question for review: the icon. I went with focus-mode; eye and focus-3 were the other candidates.

1-dropdown 2-dropdown-following 3-avatar-badge

Related Issue

  • none

How Has This Been Tested?

  • test environment: OpenCloud 8.1.0 with this branch's web build as WEB_ASSET_CORE_PATH, two users (alan, mary) in the same Yjs session
  • alan follows mary from the dropdown: row highlight, avatar badge and trigger label update; toggling again or mary leaving the session ends it
  • unit tests in YjsCollaborators.spec.ts:
    • not followingSupported: no toggle, nothing emitted (existing tests unchanged)
    • toggle emits the user id, toggling again emits null
    • followed row is highlighted, trigger label names the followed user
    • followed user moves into the visible avatar stack and gets the badge
    • own user has no toggle, following the own id emits null
    • followed user leaving the session emits null
  • packages/web-pkg/tests/unit/editor (the text editor toolbar uses the component), eslint, prettier, check:types in web-pkg

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@dschmidt dschmidt self-assigned this Oct 14, 2026
@dschmidt
dschmidt force-pushed the feat/yjs-collaborators-follow branch from 24b1e32 to 1b4533d Compare October 14, 2026 19:29
Apps opt in with the followingSupported prop and bind the followed user id
via v-model:following. The list gets a follow toggle per peer, the followed
user is highlighted, moved into the avatar stack with a badge and named in
the trigger label. Following the own user is not possible and a followed
user who leaves the session is released.
@dschmidt
dschmidt marked this pull request as ready for review October 14, 2026 19:33
@dschmidt
dschmidt requested a review from JammingBen October 15, 2026 06:33

@JammingBen JammingBen left a comment

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.

LGTM overall, just one nitpick.

The follow toggle carries aria-pressed, which ARIA only allows on a button; as a menu the drop overwrote every item with role=menuitem.
An empty collaborator list is a session that is still syncing, not a user who left, so it no longer cancels following.
@JammingBen
JammingBen merged commit aee96f6 into main Oct 20, 2026
27 checks passed
@JammingBen
JammingBen deleted the feat/yjs-collaborators-follow branch October 20, 2026 11:04
@openclouders openclouders mentioned this pull request Oct 20, 2026
1 task
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