Skip to content
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

Layout jumps when selecting an image #44359

Closed
jameskoster opened this issue Sep 22, 2022 · 10 comments · Fixed by #44965
Closed

Layout jumps when selecting an image #44359

jameskoster opened this issue Sep 22, 2022 · 10 comments · Fixed by #44965
Assignees
Labels
[Block] Image Affects the Image Block [Block] Quote Affects the Quote Block [Type] Enhancement A suggestion for improvement.

Comments

@jameskoster
Copy link
Contributor

jameskoster commented Sep 22, 2022

Most on-select layout shifts have been removed from the editor, but the image caption and quote citation fields still cause a jump. Let's move these field into a toolbar button, to avoid layout shifts.

Quote, Cite buttons

The toolbar button should only show when the caption is empty.


Issue updated Oct 14.

Initial proposal ![jump](https://user-images.githubusercontent.com/846565/191715985-0b294c8d-a297-45b2-a3f1-c5ab6d41c541.gif)

Blocks beneath Image will 'jump' when the image is selected, owing to the requirement for the 'Add caption' input to appear. This can be disorienting.

The same thing happens for the Citation element in the Blockquote block.

Let's explore ways we can mitigate this.

@jameskoster jameskoster added [Type] Enhancement A suggestion for improvement. Needs Design Needs design efforts. [Block] Image Affects the Image Block [Block] Quote Affects the Quote Block labels Sep 22, 2022
@jasmussen

This comment was marked as resolved.

@jasmussen jasmussen added Needs Design Feedback Needs general design feedback. and removed Needs Design Needs design efforts. labels Oct 6, 2022
@mtias
Copy link
Member

mtias commented Oct 7, 2022

For images, I'd probably move "add caption" right after the alignment icon since it's pretty important. Would also be good to explore a caption button overlaid on top of the image canvas, just to exhaust all options.

@mtias mtias mentioned this issue Oct 7, 2022
57 tasks
@jasmussen
Copy link
Contributor

Updated order of buttons in the image block toolbar:

Quote, Cite buttons

Overlay buttons are tricky. Not just designwise, but mostly I feel like it just makes me wonder why it isn't in the block toolbar. Mainly tricky is that the button probably has to remain an icon button, as we can't know how small the image is, so that it would fit a text label:

overlay button

@jameskoster
Copy link
Contributor Author

I like it in the toolbar, where it can behave like a toggle.

@ntsekouras
Copy link
Contributor

So if we have a toolbar button, will be a toggle to remove caption if exists? Also can you share the svg we want for this one? Thanks!

@jameskoster
Copy link
Contributor Author

So if we have a toolbar button, will be a toggle to remove caption if exists

I think it would be toggled off by default. Toggling it on reveals the caption input.

It would be nice if the block could "remember" the caption if one was added. That way if you toggle it off by accident you can toggle it on again in one click rather than having to type the caption text again.

Here's the SVG:

<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6 5.5h12a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5ZM4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm4 10h2v-1.5H8V16Zm5 0h-2v-1.5h2V16Zm1 0h2v-1.5h-2V16Z" /></svg>```

@mtias
Copy link
Member

mtias commented Oct 13, 2022

I don't think it should be a toggle. If a caption is present, there should be no button. The toolbar button should only show when the caption is empty.

@ntsekouras ntsekouras self-assigned this Oct 13, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 14, 2022
@jasmussen jasmussen added Needs Dev Ready for, and needs developer efforts and removed Needs Design Feedback Needs general design feedback. labels Oct 14, 2022
@jameskoster
Copy link
Contributor Author

Won't it be a bit strange if the button just disappears when you click it? 🤔 I guess we can figure it out in the PR :)

@jasmussen
Copy link
Contributor

Feels pretty good to me.

@jameskoster
Copy link
Contributor Author

Ah, it's disabled on click and hidden thereafter. That works!

@priethor priethor removed [Status] In Progress Tracking issues with work in progress Needs Dev Ready for, and needs developer efforts labels Nov 2, 2022
@priethor priethor added this to the Gutenberg 14.4 milestone Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Block] Quote Affects the Quote Block [Type] Enhancement A suggestion for improvement.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants