New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
website: cannot Ctrl-F for line numbers on golang.org/src pages #23724
Comments
That CSS pattern is also the cause of #23500 |
I think the wanted side-effect is that you can copy&paste code without selecting the line numbers, but maybe there's another way that doesn't break CTRL+F. |
There could be two inline-divs in a div, left with a div for each line number and right containing the pre. The pre could be rendered and the dimensions taken to calculate the height for the line number divs. There may be another idiomatic approach though, my experience hasn't been with text layout. |
@rasky is correct. This is done to prevent line numbers from appearing when you cut and paste the code. I agree that it’s a pain not to be able to ctrl-f to line numbers. We should find a solution.
That bug is due to a bug in Firefox. Our usage of the
This would Introduce even more complexity as you’re then reliant on JS for your layout. Something we’d like to avoid. |
I personally don't like when I search in a webpage and it finds line numbers and other "background" elements... also line numbers are sequential, so scrolling to the line you're looking for is really quick. You can also append |
@rasky @andybons But there is already a rule .ln {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
} so either one of these rules isn't necessary, or this is some weird browser compatibility hack. @ALTree Using the anchors for lines is certainly useful, but how is a user supposed to guess that each line number has been assigned an ID of the form |
@alexbecker The spec for
as a result, Firefox and Chrome 64 (released two weeks ago) implement the behavior we want. Safari is still an open bug (https://bugs.webkit.org/show_bug.cgi?id=80159). Given our desktop usage, we should change to use |
So, just to be clear, this issue is about removing the .ln::before {
content: attr(data-content);
} and putting the line numbers inside the span. Because Did I get that right ? |
@agnivade yes that's correct. |
Cool. Waiting for 1.11 to open 😄 |
My bad, I misunderstood how this works. Sorry for the churn from my comment. I confirmed on Chrome 64 and Firefox 58 with the debug editors that putting the line number in an ln span (with the leading tab and two |
Change https://golang.org/cl/93975 mentions this issue: |
Ran into this trying to debug a panic where the stack trace included
crypto/tls/common.go:717
. Ctrl-F searching for717
on the line-numbered source code athttps://golang.org/src/crypto/tls/common.go
gave no results, leading to brief confusion and forcing me to scroll manually until I found the right line, which is much slower than using Ctrl-F.This is because the line number nodes have no actual content, and instead are implemented as a CSS pseudo-class rule:
and setting the
data-content
property on each line number node. This seems user-hostile and i18n-unfriendly, not to mention needlessly complex. Why not just have a line number in the DOM?The text was updated successfully, but these errors were encountered: