Automattic / Automattic/isolated-block-editor

Selection isn't passed with isTriggeredByYDoc

Open
#138 0 comments 0 reactions 0 assignees View on GitHub
[Feature] Collaboration bug
Dominant language
CSS
Stars
409
Forks
66
PR merge metrics
No merged PRs in 30d

Description

When a `UPDATE_BLOCKS_WITH_UNDO` is triggered and `isTriggeredByYDoc` is present the `selection` isn't passed. This has the effect of resetting the selection status in the editor undo history, and when you travel to the point the focus is removed from the editor.

To reproduce:
- Start storybook 'with on load'
- Click on the end of the first line, press enter, and type a letter (`a`)
- Press undo
- Press undo. Focus has now been lost

Looking at the store actions. The `selection` is passed here:

![image](https://user-images.githubusercontent.com/1277682/167104914-f105f84f-724c-4a56-997f-b28a9b08ce01.png)

However it isn't here:

![image](https://user-images.githubusercontent.com/1277682/167104981-73b62b85-be68-4f2c-9077-ee1817d81064.png)

I'm not sure why the number of blocks would be so different either

Contributor guide

No contributing guide indexed for this repository

Research direction

Start the Storybook “with on load” scenario and inspect the store actions for UPDATE_BLOCKS_WITH_UNDO, comparing the path where selection is passed with the isTriggeredByYDoc path. Reproduce the two-undo sequence and verify that the selection remains available and editor focus is retained afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
storybook
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.