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

Fix: Drop Cap + alignment produces a gap between paragraphs #18831

Merged

Conversation

jorgefilipecosta
Copy link
Member

Description

Fix: #18409

These group fo styles were added in #12177 to fix an issue with one-line paragraphs and drop cap. It seems removing clear: both; fixes #18409
bug and keeps the fix added in #12177.

How has this been tested?

I verified bug #18409 was fixed and verified we did not regress on the problem #12177 addresses.

@jorgefilipecosta jorgefilipecosta added [Type] Bug An existing feature does not function as intended [Block] Paragraph Affects the Paragraph Block labels Nov 29, 2019
Copy link
Contributor

@epiqueras epiqueras left a comment

Choose a reason for hiding this comment

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

This does regress #12177. The drop cap now overflows the hover area again.

@jorgefilipecosta jorgefilipecosta force-pushed the fix/drop-cap-alignment-produces-a-gap-between-paragraphs branch from 561eb17 to 91b2898 Compare December 4, 2019 18:36
@jorgefilipecosta
Copy link
Member Author

jorgefilipecosta commented Dec 4, 2019

Hi @epiqueras, thank you for the review! It seems I missed something in my tests. It turns out that addressing this problem is more complex, I proposed a new solution.

Copy link
Contributor

@epiqueras epiqueras left a comment

Choose a reason for hiding this comment

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

packages/block-library/src/paragraph/edit.js Outdated Show resolved Hide resolved
packages/block-library/src/paragraph/edit.js Show resolved Hide resolved
packages/block-library/src/paragraph/edit.js Outdated Show resolved Hide resolved
packages/block-library/src/paragraph/edit.js Outdated Show resolved Hide resolved
packages/block-library/src/paragraph/edit.js Outdated Show resolved Hide resolved
@jorgefilipecosta
Copy link
Member Author

Hi @epiqueras,

I think we could do this with pure CSS.

Some ideas:
stackoverflow.com/a/17761830
stackoverflow.com/questions/7166716/unexplained-white-space-when-using-clearboth
stackoverflow.com/questions/5684951/the-css-property-clear-leaves-a-huge-empty-space?noredirect=1&lq=1

I tried lots of things with pure CSS and I was not able to find a solution that works on all case.
The problem with setting a clear right or left is that the previous image may be on the right or left so setting a clear breaks the things and creates white space.

@jorgefilipecosta jorgefilipecosta force-pushed the fix/drop-cap-alignment-produces-a-gap-between-paragraphs branch from 91b2898 to 14c1d84 Compare December 4, 2019 20:48
@epiqueras
Copy link
Contributor

Did you try this one: https://stackoverflow.com/a/5685062?

@jorgefilipecosta
Copy link
Member Author

Hi @epiqueras,
Yes, I tried to use something like:

.has-drop-cap:not(:focus)::after {
        clear: both;
        height: 0px;
        overflow: hidden;
    }

And unfortunately, it did not work.

@epiqueras epiqueras merged commit 8966f52 into master Dec 5, 2019
@epiqueras epiqueras deleted the fix/drop-cap-alignment-produces-a-gap-between-paragraphs branch December 5, 2019 15:57
@youknowriad youknowriad added this to the Gutenberg 7.1 milestone Dec 9, 2019
@ellatrix
Copy link
Member

@jorgefilipecosta This doesn't work in Firefox, probably because the selector isn't working:

Screenshot 2020-01-23 at 11 16 31

@ellatrix
Copy link
Member

Additionally, it seems like this is only applied in the editor? Previously this worked on the front-end too.

@jorgefilipecosta
Copy link
Member Author

I'm sorry for the delay @ellatrix, I lost this mention. Thank you for fixing this issue 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Paragraph Affects the Paragraph Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop Cap + alignment produces a gap between paragraphs
4 participants