TextKit2 textContentManager(_:shouldEnumerate:options:) leaves gaps in layout

Returning false from NSTextContentManagerDelegate.textContentManager(_:shouldEnumerate:options:) produces huge gaps in my layout instead of showing a continuous block of text.

Instead of omiting the layout of the hidden element, there is a blank space that shows that appears to have the same size in layout as the omitted text element.

Why is this happening and how can I prevent this?

Example: