Skip to content

Conversation

@johngodley
Copy link
Contributor

@johngodley johngodley commented Nov 21, 2018

A short paragraph with a dropcap shows a hover area that is too small:

edit_post_ _wordpress_latest_ _wordpress

This is because the dropcap letter is floated and the height isn’t taken into account, causing the block’s hover area to be incorrect. A paragraph that spans multiple lines won't exhibit this problem as the height is provided by the rest of the text.

This PR clears the dropcap so the height is applied.

Fixes problem in #12172
Fixes #12177

How has this been tested?

  1. Create a post with a single paragraph block
  2. Enable dropcaps from block options
  3. Hover over the block and note the hover area is shown around the dropcap and content

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

Because the dropcap letter is floated, the height isn’t taken into account, causing the block’s hover area to be incorrect. Clear the float so the height is applied.
@johngodley johngodley added the [Status] In Progress Tracking issues with work in progress label Nov 21, 2018
font-style: normal;
}

&.has-drop-cap::after {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we apply this only when the RichText is focused? The dropcap is not shown when the block is focused.

Right now, if you type in a block with DropCap you can see that it's height is not the regular height because of this style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you mean apply only when not focussed, then yes I missed that, and added!

If you do mean focussed then I'm not sure - can you add a screenshot?

@youknowriad youknowriad removed the [Status] In Progress Tracking issues with work in progress label Dec 4, 2018
@youknowriad youknowriad added this to the 4.8 milestone Dec 4, 2018
@oandregal oandregal self-requested a review December 7, 2018 16:01
Copy link
Member

@oandregal oandregal left a comment

Choose a reason for hiding this comment

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

Works as expected!

@youknowriad youknowriad merged commit 0222ecf into master Dec 20, 2018
@youknowriad youknowriad deleted the fix/dropcap-clear-height branch December 20, 2018 08:42
youknowriad pushed a commit that referenced this pull request Jan 3, 2019
* Paragraph: clear dropcap height so hover area shown correctly

Because the dropcap letter is floated, the height isn’t taken into account, causing the block’s hover area to be incorrect. Clear the float so the height is applied.

* Restrict dropcap clearer to only focussed block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants