Skip to content
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

Table layout causes diff and line highlight errors #142

Open
robertg042 opened this issue Feb 16, 2021 · 3 comments
Open

Table layout causes diff and line highlight errors #142

robertg042 opened this issue Feb 16, 2021 · 3 comments
Labels
bug Something isn't working help wanted Would love a PR

Comments

@robertg042
Copy link

Hi, first of all, thanks for the awesome plugin!

While testing in IE and in modern webkit browsers, I discovered few issues. The common culprit seems to be usage of table layout and the fact that relative positioning of elements is not always respected in this layout.

  1. In IE line hightlight is not displayed at all, because of custom variables, which I guess is ok. If you set regular background-color you'll find that grvsc-line::before pseudoelement is mispositioned:

IE with custom background

  1. In modern Chrome, Safari and Edge, however, position: relative on display: table-row on grvsc-line is not respected, which results in width: 100% applied to grvsc-line::before being equal to the width of grvsc-container and not grvsc-line. It causes problems with highlight beyond horizontal overflow:

chrome, diff, not scrolled

chrome, diff, scrolled

chrome, highlight, not scrolled

chrome, highlight, scrolled

Those styles seems to work as a workaround:

  .grvsc-code {
    position: relative;
    width: 100%;
  }
  .grvsc-line {
    position: static;
  }

Firefox has no issues:

firefox

Sources:

@andrewbranch andrewbranch added the bug Something isn't working label Feb 16, 2021
@andrewbranch
Copy link
Owner

Hmm, you’re very correct... unfortunately, making .grvsc-code 100% wide when the code doesn’t take up the full width makes the gutter cells grow (they’re supposed to be flush left):

image

I’ll keep experimenting. Thanks for the heads up!

@robertg042
Copy link
Author

Thanks for looking into the issue. I admit I haven't run the tests while testing my solution. It's just what works for me right now.

@andrewbranch
Copy link
Owner

I think CSS Grid might be a viable solution here. Not sure when I’ll have time to give it a try.

@andrewbranch andrewbranch added the help wanted Would love a PR label Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Would love a PR
Projects
None yet
Development

No branches or pull requests

2 participants