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

Focus the default block after it gets added at the end of the canvas #65849

Closed
2 tasks done
afercia opened this issue Oct 3, 2024 · 9 comments · Fixed by #66143
Closed
2 tasks done

Focus the default block after it gets added at the end of the canvas #65849

afercia opened this issue Oct 3, 2024 · 9 comments · Fixed by #66143
Assignees
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Oct 3, 2024

Description

When clicking the empty area at the end of the canvas, the default block (a paragraph) gets added. However, the new added block is not selected. As such, it doesn't get focus. As a user, to start using the new block or the 'slash inserter' I have to click again the editable part of the new block. Animated GIF to illustrate:

Image

I'm not sure whether there are reasons to not select and move focus the default block but the current behavior seems inefficient to me and there's room to improve usability and accessibility. As an user, I don't want to click twice. I just want to click and start typing.

I may be missing something but if there are no side effects on other flows, keyboard operability and such, I'd say that one click less would be a quick win to provide some better user experience.

Step-by-step reproduction instructions

  • Create a post.
  • Add a block e.g. a Group.
  • Using a pointing device, click the area below the Group block.
  • Observe the default block is added into the canvas.
  • Observe the default block is not selected.
  • Observe the default block editable content is not focused.
  • Observe you have to click again the block to select it and be able to start writing or using the slash inserter.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@afercia afercia added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended labels Oct 3, 2024
@stokesman
Copy link
Contributor

Thanks for opening the issue. I was about to report on the same thing. However, in my experience this only happens when the editor iframe is not present. Can you confirm? I.e. it does work if the canvas is in the iframe.

@stokesman

This comment has been minimized.

@afercia
Copy link
Contributor Author

afercia commented Oct 8, 2024

Thanks for opening the issue. I was about to report on the same thing. However, in my experience this only happens when the editor iframe is not present. Can you confirm?

@stokesman thanks for looking into this. For me, this happens with the editor iframed as well.

GIF to illustrate:

Image

@stokesman
Copy link
Contributor

Thanks Andrea 🙇, I hadn’t been seeing it in the iframed editor because when I noticed it I was on an older branch and forgot to check latest trunk.

git bisect pointed me to d9551aa as the commit that regressed it. I’m still in the dark as to why.

@stokesman
Copy link
Contributor

stokesman commented Oct 11, 2024

Still pretty stumped on this but from testing it was working in 6.6.1 and broken in 6.6.2. It is currently broken in 6.7 beta. I'm not sure if that qualifies it for fixing it in 6.7 at this phase of the release cycle.

@t-hamano
Copy link
Contributor

t-hamano commented Oct 14, 2024

I have confirmed this issue.

6.6.1 correctly focuses the last block, but 6.6.2, 6.7 Beta1, confirmed that it doesn't work properly. d9551aa is a revert commit, so I'm wondering why the issue reoccurred in this commit. Maybe d9551aa unintentionally fixed the focus issue 🤔

@stokesman
Copy link
Contributor

stokesman commented Oct 14, 2024

Maybe d9551aa unintentionally fixed the focus issue

I take it you mean the changes reverted by that commit had been a fix. It’s what I thought too. To test, I checked out the reverted commit’s parent 609a3c8 and found focus worked there. Because of that (and the fact that focus was never actually handled by the padding appender hook) it makes me suspect that the revert wasn’t a perfect reversal. I could be missing something though.

Aki, do you have a clear idea about possibility of getting this fixed for 6.7? I wasn’t sure if it qualifies due to it having not been introduced by 6.7. I would nice to, but if not, I guess it can be in a minor release.

@stokesman
Copy link
Contributor

I think I’ve figured this out but it’s EOD for me so I’ll finish confirming it tomorrow and see about a PR then.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 15, 2024
@stokesman
Copy link
Contributor

To sum it up succinctly, the revert d9551aa only regressed this because the padding appender hook had also changed. That revert meant the padding appender’s changes needed a partial revert. A little more detail is in the PR I linked to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Editor /packages/editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants