Automattic / Automattic/isolated-block-editor
Selection isn't passed with isTriggeredByYDoc
- 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:

However it isn't here:

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