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

Reduce paragraph block CSS specificity #13025

Merged
merged 4 commits into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 14 additions & 0 deletions packages/block-library/src/paragraph/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@
padding-right: $icon-button-size;
}
}

// 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.
// As a visual indicator that a drop cap is present, use font-size and
// text-shadow to make the first letter a tiny bit larger than paragraph text.
.has-drop-cap:focus::first-letter {
float: none;
font-size: 1.2em;
line-height: inherit;
margin: 0 0.1em 0 0;
text-shadow: -1px 0 currentColor, 0 1px currentColor, 1px 0 currentColor, 0 -1px currentColor;
}
2 changes: 1 addition & 1 deletion packages/block-library/src/paragraph/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ p {
// 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 {
&.has-drop-cap::first-letter {
float: left;
font-size: 8.4em;
line-height: 0.68;
Expand Down