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

Refactor template select field to use SelectControl #8987

Merged

Conversation

chrisvanpatten
Copy link
Contributor

@chrisvanpatten chrisvanpatten commented Aug 14, 2018

Description

This fixes #8985 by refactoring the template select field to use SelectControl instead of an inline <select>. This applies the appropriate classes and such so the spacing is correct.

How has this been tested?

Visually in browser, ran automated tests, Travis passes

Screenshots

Before:
edit_page_ mindful _wordpress

After:
edit_page_ mindful _wordpress

Types of changes

Replaces <select> with <SelectControl>.

My main concern is that previously this select also had an onBlur handler, but there isn't an onBlur option on <SelectControl> so I removed it. This might be a huge mistake! In my testing it didn't seem to cause any issues, but it is worth noting.

I also removed the use of withInstanceId because that's natively supported in SelectControl, but again this could be a giant mistake.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@chrisvanpatten chrisvanpatten added [Feature] Document Settings Document settings experience [Package] Editor /packages/editor labels Aug 14, 2018
@chrisvanpatten chrisvanpatten requested review from jorgefilipecosta and youknowriad and removed request for jorgefilipecosta August 14, 2018 18:19
<SelectControl
label={ __( 'Template:' ) }
value={ selectedTemplate }
onChange={ ( value ) => onUpdate( value ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

It could be simplified: onChange={ onUpdate }

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Good change 👍

@chrisvanpatten chrisvanpatten merged commit dfada03 into WordPress:master Aug 15, 2018
@chrisvanpatten chrisvanpatten deleted the fix/template-select-control branch August 15, 2018 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Document Settings Document settings experience [Package] Editor /packages/editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increase spacing under label for template selection
2 participants