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

Editor: Avoid focus attempt on a non-existent post title in code editor #29922

Merged
merged 1 commit into from
Mar 29, 2021

Conversation

jeremyfelt
Copy link
Member

Description

If a post type has no title support, then ref.current is undefined and there is no ownerDocument to read nor title to focus. See #29921

How has this been tested?

  1. Register a post type with no title support
  2. Add a new post of that post type
  3. Attempt to switch to code editor view

  1. Register a post type with title support
  2. Add a new post of that post type
  3. Attempt to switch to code editor view

Types of changes

Bug fix, see #29921.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

If a post type has no title support, then `ref.current` is
`undefined` and there is no `ownerDocument` to read nor title
to focus.
Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @jeremyfelt 👍

@ntsekouras ntsekouras merged commit 9b75a5c into WordPress:trunk Mar 29, 2021
@github-actions github-actions bot added this to the Gutenberg 10.4 milestone Mar 29, 2021
@jeremyfelt jeremyfelt deleted the fix/post-title-useeffect branch March 29, 2021 17:02
@gziolo gziolo changed the title Avoid focus attempt on a non-existent post title in code editor Editor: Avoid focus attempt on a non-existent post title in code editor Apr 6, 2021
@gziolo gziolo added [Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended labels Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants