-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add idle detection to collaboration feature #2877
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/excalidraw/excalidraw/24xh73pu2 |
My first thoughts were: let's not add another checkbox and complicate the UI. But then I read you need to opt-in (makes sense), so we can't make it non-optional :(. If I understand the API correctly, it won't go into idle state if the user is doing something in other tabs (which for the purpose of the collab session is useless). If we think this adds enough value, we can easily roll out a custom implem which will have these benefits:
If we were worried about timers being slowed down in inactive tabs, we can send pingAlives to our WS server (and stop sending them when blurring the document). |
Not just doing something in other tabs (that is, still in the browser), but also doing something in other apps (like looking up technical details in a PDF opened in Preview that they need for a flow diagram you’re collaborating on in Excalidraw). The core use case is knowing the other party is still active as in “using their computing device”, so you know they’re still there. |
Is it useful to know the person is on their device doing some unrelated work? If she's not focusing on the canvas, what good will this knowledge be to her collaborators? It's also rather privacy intrusive (and being a new API, and given the nature of Excalidraw, we'd need to let users know to what extent they'll be spied on). |
It can make a difference, as in “do you get a coffee, too, since your collaborators all are gone with their screen locked”, or do you maybe wait a little longer.
It’s a progressive enhancement; teams (or individuals) can agree to turn this on or leave it off. We have seen similar UI for years in essentially all installed chat clients that have an option to set your status automatically, starting from good ol’ ICQ, to Skype, to Miranda, to Adium (that’s the last I had installed since everything is on the Web now). Here’s an example documentation page from Adium or another from Zendesk chat. |
We must answer the following questions:
Anything that's opt-in, and has a privacy disclaimer and considerations, introduces a big friction point, and must justify its cost. |
Here's a design iteration (not implemented, just sketched as an idea) to make the UI simpler, and more transparent. (The images for the legend would be properly aligned and cropped to show just the cursor of course). Thanks, @dwelle, for your thoughts already. Any other ideas from anyone else? |
I feel like the fact that this feature is opt-in from Chrome makes it unappealing within Excalidraw. If everyone has it, then this is a nice to have feature and would be helpful to know who is looking at the document. But I don't believe that this is worth prompting people to enable. Adding a hidden option is likely not going to get any usage and add a lot of complexity to the codebase. I believe we should not add this. Thanks @tomayac for bringing it up, would have been a nice thing! |
Gotcha, and fair point about the prompt. That’s a good signal to feed back to Chrome engineering too. I can easily refactor this PR to not use the new API, but a more traditional approach of just looking at input events etc. Would this be appealing then? |
@tomayac I'm fine displaying the user as active or inactive whether they are currently on the tab, I think there's tab visibility for that. And we shouldn't have any options, just enable it by default. |
👍 Sounds good. I’ll refactor the PR accordingly. |
As for feedback on the idle detection API, I think it should support customizing the detection scheme. It should also allow to just specify "detect if user has the tab focused, and is interacting with the document". In that scenario it shouldn't prompt (there's no privacy concern because you can already implement that on your own). It should definitely keep prompting for what it does right now: detecting idle state across tabs & OS apps — not only that, it should explicitly say in the prompt that it'll do this (which I didn't know about when I read it at first). |
@dwelle This is great feedback! Would you be willing to share this word for word on https://github.com/WICG/idle-detection/issues maybe? |
We now have three states:
|
Play with this in the staged deploy: https://excalidraw-cq4z4eeln.vercel.app/#room=46304965d5b959b85c50,2CGSvqfkQFMfTTWj-2r8MQ. |
We can iterate later and maybe adjusting the icons according to the actual color of the user.. but something for another PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the first iterration is pretty good! Like I mentioned before, we could tweak the icons/colors later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
* 'master' of github.com:excalidraw/excalidraw: fix: make scrollbars draggable when offsets are set (#2916) chore: Run actions on pull requests as well (#2917) feat: Add idle detection to collaboration feature (#2877) fix: pointer-events being disabled on free-draw (#2912) feat: don't store to LS during collab (#2909)
* 'master' of github.com:excalidraw/excalidraw: (58 commits) chore: Update translations from Crowdin (#2906) fix: toolbar unnecessarily eats too much width (#2924) fix: mistakenly hardcoding scale (#2925) fix: text editor not visible in dark mode (#2920) feat: support supplying custom scale when exporting canvas (#2904) fix: incorrect z-index of text editor (#2914) feat: Show version in the stats dialog (#2908) fix: make scrollbars draggable when offsets are set (#2916) chore: Run actions on pull requests as well (#2917) feat: Add idle detection to collaboration feature (#2877) fix: pointer-events being disabled on free-draw (#2912) feat: don't store to LS during collab (#2909) chore: Update translations from Crowdin (#2898) fix: track zenmode and grid mode usage (#2900) refactor: Use the latest vercel configuration instead of now (#2893) chore: Update translations from Crowdin (#2894) Update i18n.ts Update locales-coverage-description.js feat: add view mode in Excalidraw (#2840) chore(deps): bump @sentry/integrations from 6.0.1 to 6.0.3 (#2889) ...
📢 PLEASE SEE #2877 (comment) for the description of this PR, the below is no longer accurate.
The problem
When collaborating with others, it can at times be really confusing: Is the other person just staring at the screen thinking? Are they busy in another app? Did they grab a coffee ☕️ and their screen has even locked?
The solution
The Idle Detection API is a new Web platform API proposal that lets Web applications know if the user is present at their device. This API notifies developers when a user is idle, indicating such things as lack of interaction with the keyboard, mouse, screen, activation of a screensaver, locking of the screen, or moving to a different screen. A developer-defined threshold triggers the notification.
How it works
This PR adds Idle Detection to the collaboration feature. It works as follows:
The user is active:
The user is idle, but their screen is still unlocked:
The user is idle, and their screen has locked:
Important background info
The minimum threshold for idle detection to kick in is 60s. That is, when you lock the screen or become inactive, it can take up to one minute for the change to be propagated. This is so different sites cannot collaborate and fingerprint you based on your idle state (more details).
Testing this feature
To test this, enable the
chrome://flags/#enable-experimental-web-platform-features
flag. Be sure to set a username, else, it won't show up. The final deployed version will use an origin trial (similar as we had with the File System Access API). You don't have to wait one minute to test state changes if you use Chrome DevTools: