-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Preserve selection when switching block editor tabs #18239
Comments
@mapk @jasmussen since fixing this is a matter of simply not clearing the selection anymore, by removing a single call to @jorgefilipecosta is there any technical reason to clear the block selection? |
@mtias and @jasmussen for posterity, here is a sum up of what we discussed:
The argument is this:
My opinion is that:
Another thing that popped up in discussion is being future proof: we might have a new "Site" tab very soon when we start seeing signs of FSE in the editor. I think this is yet even more of a reason to stop clearing block selection. If at some point in the future we will require moving the selection in the document because we switched tabs, only then it is a good time to implement a mechanism for remembering previous selection states and applying them. Implementing such a mechanism today will most likely require a refactor when block areas and whatnot shall appear. The final thing is that the inspector is contextual and I also disagree with that, the inspector tabs are contextual not the entire inspector. Similar to this, desktop software only have contextual toolbars or sidebars, never changing things you can't see (such as the block tab in our case). One example, props to @noisysocks , which behaves similar is Apple Pages where switching inspector tabs, even to document, does not clear any selection in the document: |
As another example, Blocs.app seems to clear the selection when clicking another tab but returns the selection when the tab is clicked back again. If the selection in Gutenberg didn't clear, what would happen if I have a block selected and clicked the Document tab? Would I just see the Document settings, but the block would still remain selected? Looking at the example from @noisysocks, it may not be a bad decision. |
Yes @mapk that's what I propose: when we click the Document tab we leave the current selected block be selected. That's all. |
When we select a block, we switch to the block editor tab. I guess to have a block selected and show the document tab; we would need some changes on the logic of how selection and the tabs work. But I would not say it is something hard to change. |
@jorgefilipecosta shouldn't we simply not deselect the block anymore instead of making some more complication? Opening the block tab when we select a block is fine. Only deselecting the block when switching to the document tab should be removed. @jasmussen or @mtias what do you still think about this? Should we let go of the current behaviour? |
I appreciate the desire to improve things. But given this is an issue that has been argued to be working as intended by at least a couple of folks, it feels like a lot of energy has been spent on this instead of working on reported bugs or reviewing open PRs. This tells me that this kind of issue is one that should just be tried, and kept if it works, reverted if it doesn't. But only if that can happen fast, it doesn't feel worth spending weeks on. |
Describe the bug
This is probably an intended feature, but when switching tabs in the editor sidebar between document and block, the current block selection is lost.
The problem is easily recoverable on desktop, but it presents an almost empty screen on mobile, looking like an error.
To reproduce
Steps to reproduce the behavior:
Expected behavior
I expect the selection to be preserved because there is nothing I did to it by fiddling with the sidebar's tabs.
The text was updated successfully, but these errors were encountered: