Repository navigation
fix(web): dispatch the ready event after clipboard initialization - #2018
Merged
Benoît Cortier (CBenoit) merged 1 commit intoOct 1, 2026
Conversation
`ready` was dispatched at the end of canvas initialization, before `ClipboardService.initClipboard()` had run: that awaits a permissions query, and only then installs the clipboard callbacks. `connect()` registers those callbacks on the session builder only if they are installed, so a host that connects as soon as `ready` fires got a session without a clipboard channel. Connecting after a user action (as iron-svelte-client does) hides the race. Dispatch `ready` once the clipboard is initialized (or its initialization failed), so connecting on it always sets up the clipboard. Adds a component test for it. Mounting the component under vitest needs Svelte's browser build (`resolve.conditions`) and skipping vite-plugin-svelte's style preprocessing, which fails under vitest 2's bundled Vite 5; the component's styles are plain CSS.
meanaverage (meanaverage)
deployed
to
llm-providers
September 26, 2026 16:53 — with
GitHub Actions
Active
Contributor
|
Automated review will not run because this contributor is not yet eligible under the automation policy. Contributors become eligible after one qualifying IronRDP pull request is merged into |
Benoît Cortier (CBenoit)
approved these changes
Oct 1, 2026
Benoît Cortier (CBenoit)
left a comment
Member
There was a problem hiding this comment.
Clean fix, LGTM, thank you!
Benoît Cortier (CBenoit)
enabled auto-merge (squash)
October 1, 2026 08:11
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
<iron-remote-desktop>dispatchesreadyat the end ofinitcanvas(), butonMountonly then runsawait clipboardService.initClipboard(). That awaitsnavigator.permissions.query({ name: 'clipboard-read' })before installing the clipboard callbacks, andRemoteDesktopService.connect()only registersremoteClipboardChangedCallback/forceClipboardUpdateCallbackon the session builder when those callbacks are installed.So a host that connects as soon as
readyfires gets a session with no CLIPRDR channel, and the clipboard silently doesn't work. iron-svelte-client connects after the user clicks, which hides the race.Change
readyis dispatched fromonMountafterinitClipboard()settles. If clipboard initialization throws, the error is logged andreadystill fires.vite.config.tssetsresolve.conditions: ['browser']whenVITESTis set. It also skips vite-plugin-svelte's style preprocessing in that case: the plugin (5.x, for Vite 6) crashes inpreprocessCSSunder vitest 2's bundled Vite 5. The component's styles are plain CSS. Builds are unchanged.Testing
src/readyEvent.test.ts(2 tests):readyisn't dispatched while the permission query is pending, fires once it resolves, and connecting from it registersremoteClipboardChangedCallback. This one fails without the fix.readystill fires when the clipboard is unavailable (not a secure context).npm test(20 passing, 3 files),npm run check(0 errors),npm run lint,npm run build.readyhad no clipboard at all. With this change, text copies both ways against GNOME Remote Desktop 46 and Windows 11.Prepared with AI assistance; I reviewed the change and ran the tests above.