client icon indicating copy to clipboard operation
client copied to clipboard

Universal selector on page causes highlighted text to move to new line

Open robertknight opened this issue 4 years ago • 1 comments

Highlighting any text in the main body of https://www.nakivo.com/blog/developing-a-disaster-recovery-policy-a-step-by-step-guide/ causes the highlighted text to be moved into its own line:

Highlight display block

The document has a super-generic CSS rule that sets display: block on all elements:

body * {
  display: block;
}

One way to fix this might be to add something like all: initial as the first rule of the .hypothesis-highlight selector, which will override any universal selectors on the page.

robertknight avatar Apr 07 '21 15:04 robertknight

One way we could fix this would be to use the CSS Custom Highlight API to display highlights rather than wrap content in custom elements. Then there would be no element that a site-provided selector could unintentionally match.

robertknight avatar Apr 19 '24 14:04 robertknight