hypothesis / client

The Hypothesis web-based annotation client.
Other
630 stars 195 forks source link

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

Open robertknight opened 3 years ago

robertknight commented 3 years ago

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 commented 4 months ago

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.