find icon indicating copy to clipboard operation
find copied to clipboard

wrong count

Open davidp88 opened this issue 2 years ago • 6 comments

Open this site- https://www.gpsoft.com.au/program/program.html and search for "opus",there are only 14 matches for opus but find shows 16 matches found.Even firefox says 14 matches only.

davidp88 avatar Jan 15 '23 14:01 davidp88

It also finds occurrences that are hidden by CSS. Sometimes this can also be an advantage.

Aybee avatar Jan 15 '23 19:01 Aybee

Who said so?

Aybee avatar Jan 16 '23 11:01 Aybee

The two extra occurrences are from the navbar, which have a visibility: hidden style applied to them. In the extensions plugin scripts, isHiddenElement doesn't account for this. Should be an easy fix.

brandon1024 avatar Jan 16 '23 15:01 brandon1024

There are many other ways to hide elements from visibility. E.g. this often used class to show elements only to screenreaders from Contao CMS

.invisible {
	border: 0;
	clip: rect(0 0 0 0);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
}

or this from Bootstrap

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

But there are many others

Element {
	overflow: hidden;
	text-indent: 100%;
}
Element {
	position: absolute;
	z-index: -1;
}
Element {
	position: absolute;
	left: -10000px;
}
Element {
	height: 0;
	overflow: hidden;
}

And more ...

You can find many approaches on the web to find out whether the visitor sees an element or rather a text or not. I think they can all fail somehow. So this ticket is definitely not a bug.

You have to turn CSS off, to see everything.

Aybee avatar Jan 16 '23 19:01 Aybee

Chrome's built-in search also matches text in some types of hidden nodes, e.g. on this page (desktop), a search for quote will find an "invisible" occurrence, inside the tooltip for the quote button. The tooltip uses the same .sr-only CSS @Aybee shared above.

Screen Shot 2023-03-03 at 10 22 54 AM

mrienstra avatar Mar 03 '23 18:03 mrienstra