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

Shared blocks: Fix: Name field isn't focused when a shared block is created #7987

Merged

Conversation

jorgefilipecosta
Copy link
Member

Description

This PR makes sure when we use the option to convert to a shared block name field is automatically selected.
Before we had logic using componentDidUpdate but this logic was not used when the component is mounted so now we apply similar logic on the mount.
Fixes: #7972

How has this been tested?

Create a block
Click More Options and select Convert to Shared Block
Verify the name field is selected.

Copy link
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

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

Thanks Jorge!

@@ -23,6 +23,13 @@ class SharedBlockEditPanel extends Component {
this.handleTitleKeyDown = this.handleTitleKeyDown.bind( this );
}

componentDidMount() {
// Select the input text when the form opens.
if( this.props.isEditing && this.titleField.current ){
Copy link
Member

Choose a reason for hiding this comment

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

Missing some spaces around the ()s here.

@jorgefilipecosta jorgefilipecosta force-pushed the fix/focus-Name-when-a-shared-block-is-created branch from 1c16f02 to be50d7a Compare July 17, 2018 10:55
@jorgefilipecosta jorgefilipecosta merged commit 3343e8c into master Jul 17, 2018
@jorgefilipecosta jorgefilipecosta deleted the fix/focus-Name-when-a-shared-block-is-created branch July 17, 2018 11:09
@danielbachhuber danielbachhuber added this to the 3.3 milestone Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants