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

Restore hiding drop cap on focus to prevent bugs with contenteditable #6359

Merged
merged 1 commit into from
Apr 24, 2018
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
28 changes: 13 additions & 15 deletions blocks/library/paragraph/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@ p {
font-size: 48px;
}

&.has-drop-cap {
&:first-letter {
float: left;
font-size: 4.1em;
line-height: 0.7;
font-family: serif;
font-weight: 600;
margin: .07em .23em 0 0;
text-transform: uppercase;
font-style: normal;
}
// Don't show the drop cap when editing the paragraph's content. It causes a
// number of bugs in combination with `contenteditable` fields. The caret
// cannot be set around it, caret position calculation fails in Chrome, and
// typing at the end of the paragraph doesn't work.
&.has-drop-cap:not( :focus ):first-letter {
float: left;
font-size: 4.1em;
line-height: 0.7;
font-family: serif;
font-weight: 600;
margin: .07em .23em 0 0;
text-transform: uppercase;
font-style: normal;
}
}

p.has-drop-cap:not( :focus ) {
overflow: hidden;
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this line because it seems to have just been taken over from the editable CSS, where it targeted a different element. I don't know why this line was needed back then and if it still does anything now, but it seems unlikely. It should have been commented.

}

p.has-background {
padding: 20px 30px;
}
17 changes: 0 additions & 17 deletions blocks/rich-text/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,6 @@
}
}

.has-drop-cap .blocks-rich-text__tinymce:not( :focus ) {
&:first-letter {
float: left;
font-size: 4.1em;
line-height: 0.7;
font-family: serif;
font-weight: 600;
margin: .07em .23em 0 0;
text-transform: uppercase;
font-style: normal;
}
}

.has-drop-cap:not( :focus ) {
overflow: hidden;
}

.block-rich-text__inline-toolbar {
display: flex;
justify-content: center;
Expand Down