[FSE] Remove ability to load a post within the site editor to prevent site editor inception
Description
Apologies for this strange title but I'm struggling to find the best way to explain this. Essentially, one is able to load the site editor within the site editor due to the fact that if you click on a link to a post within a query block while in the site editor, it loads the post as if you were viewing it on the front end. cc @priethor as this seems pretty serious to fix.
Step-by-step reproduction instructions
- Have a site using FSE and TT1 Blocks.
- Open the site editor.
- Scroll down to a post within the query block that you've created.
- Click on the post title link/open the link and see the post load within the editor rather than taking you elsewhere.
- Notice that you can then click "edit site" while still in the site editor.
Expected behaviour
I expect to not be able to click a link to a post and have it load within the site editor itself.
Actual behaviour
I am able to click on a link in the post within the site editor and have that individual post load an entire experience within the site editor itself.
Screenshots or screen recording (optional)
Screenshot:
Video:
https://user-images.githubusercontent.com/26996883/114109419-73c6fd00-9892-11eb-8a90-826d02a3e963.mov
WordPress information
- WordPress version: 5.7
- Gutenberg version: 10.3.2
- Are all plugins except Gutenberg deactivated? Yes
- Are you using a default theme (e.g. Twenty Twenty-One)? TT1 Blocks
Device information
- Device: Desktop
- Operating system: MacOS
- Browser: Chrome v 89
Ah, have seen this with some of the site blocks, and the short term, single block fix, was to disable clicking on the link, or use the disabled component. https://github.com/WordPress/gutenberg/pull/29564#issuecomment-813242600
For Full Site Editing to be truly full site editing, clicking a post title/link should stay within the Site Editor, surely?
Otherwise it is not full site editng, it is merely part-site editing. The post editing experience inside of the Site Editor should be improved, rather than disabling links or taking the user out of the Site Editor.
I am not sure that is always the case. A link may be clicked by mistake, or it may be clicked because you are attempting to edit the text.
One thing that is causing this is the css-in-js usage that doesn't play well in site editor, due to the iframe used (see: https://github.com/WordPress/gutenberg/issues/30553).
This is a general problem that applies here because Query block is using Disabled component and the css-in-js is not loaded. Besides the main css-in-js and iframe issue, some tweaks will be needed to apply hover events and disable the rest as it is the case for post editor (pointer-events:none is used).
Having said that, @carolinan is right about the handling(https://github.com/WordPress/gutenberg/issues/30647#issuecomment-816408347), because in the editor we care about having a preview that matches the frontend, regarding it's tag and styles. So I believe it's sufficient for blocks having links, to show them and disable click events.
https://github.com/WordPress/gutenberg/issues/30941 I happen to create a new issue for this. Carolina marked it as duplicate and closed it. (Thank you Carolina..:) Just so you know I added the console error I noticed to the issue.
@ntsekouras the css-in-js is now fixed, is there anything remaining here?
@ntsekouras the css-in-js is now fixed, is there anything remaining here?
Yes, I have to change a bit PostDate block when is made a link and will close the issue then.