-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix placeholder positioning #1477
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,20 +434,21 @@ export default class Editable extends Component { | |
|
||
render() { | ||
const { | ||
tagName, | ||
tagName: Tagname = 'div', | ||
style, | ||
value, | ||
focus, | ||
className, | ||
inlineToolbar = false, | ||
formattingControls, | ||
placeholder, | ||
inline, | ||
} = this.props; | ||
|
||
// Generating a key that includes `tagName` ensures that if the tag | ||
// changes, we unmount and destroy the previous TinyMCE element, then | ||
// mount and initialize a new child element in its place. | ||
const key = [ 'editor', tagName ].join(); | ||
const key = [ 'editor', Tagname ].join(); | ||
const classes = classnames( className, 'blocks-editable' ); | ||
|
||
const formatToolbar = ( | ||
|
@@ -472,15 +473,23 @@ export default class Editable extends Component { | |
</div> | ||
} | ||
<TinyMCE | ||
tagName={ tagName } | ||
tagName={ Tagname } | ||
getSettings={ this.getSettings } | ||
onSetup={ this.onSetup } | ||
style={ style } | ||
defaultValue={ value } | ||
isEmpty={ this.state.empty } | ||
placeholder={ placeholder } | ||
label={ placeholder } | ||
key={ key } | ||
/> | ||
{ this.state.empty && | ||
<Tagname | ||
className="blocks-editable__tinymce" | ||
style={ style } | ||
> | ||
{ inline ? placeholder : <p>{ placeholder }</p> } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious the a11y impact of having placeholder both as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question! What are your thoughts, @afercia? |
||
</Tagname> | ||
} | ||
</div> | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should include a modifier class here so reading the stylesheet is more obvious the intention on the
.blocks-editable__tinymce + .blocks-editable__tinymce
styling.