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

Chrome: Fix empty post placeholder hover effect #1200

Merged
merged 1 commit into from
Jun 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions editor/modes/visual-editor/block-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ class VisualEditorBlockList extends wp.element.Component {
<div>
{ ! blocks.length && (
<input
type="text"
readOnly
className="editor-visual-editor__placeholder"
value={ __( 'Write your story' ) }
onFocus={ this.appendDefaultBlock }
Expand Down
22 changes: 5 additions & 17 deletions editor/modes/visual-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -256,38 +256,26 @@ $sticky-bottom-offset: 20px;
}
}

.editor-visual-editor__placeholder {
.editor-visual-editor__placeholder[type=text] {
margin-left: auto;
margin-right: auto;
max-width: $visual-editor-max-width;
position: relative;
padding: $block-padding;
border: none;
border: 2px solid transparent;
Copy link
Member

Choose a reason for hiding this comment

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

Minor: Adding the border pushes the text to the right by 2px. I only noticed it upon refreshing from master to this branch, but it also appears slightly offset from both the title and following inserter.

We might consider a margin: 0 -2px to offset (optionally applying both margin and border only ever to the left side).

Can't do margin because we need the auto. Since we're already applying position: relative, we could do left: -2px instead.

background: none;
box-shadow: none;
display: block;
transition: 0.2s border-color;
text-align: left;
width: 100%;
color: inherit;
opacity: 0.5;
line-height: $editor-line-height;
font-size: $editor-font-size;
cursor: text;
left: -2px;

&:before {
z-index: z-index( '.editor-visual-editor__block:before' );
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
border: 2px solid transparent;
transition: 0.2s border-color;
}

&:hover:before {
&:hover {
border-left-color: $light-gray-500;
@include animate_fade;
}
}