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

tab-size broken in new code view #6461

Closed
rakuzen25 opened this issue Apr 6, 2023 · 9 comments · Fixed by #6480
Closed

tab-size broken in new code view #6461

rakuzen25 opened this issue Apr 6, 2023 · 9 comments · Fixed by #6480
Labels

Comments

@rakuzen25
Copy link

Description

When the GitHub tab size preference is set to anything but 4, the tab display is broken under the new code view preview (the old one, without directory listing on the left side, is not affected).

Screenshot

Upon inspection, it seems like GitHub added a read-only textarea element behind the existing code display, which is overriden by the catch-all rules in tab-size.

* {
tab-size: var(--tab-size) !important;
}

:root, /* Changes the browser default */
.comment-body [data-tab-size='8'], /* User setting is ignored in comments #4833 */
[data-tab-size='4'] {
--tab-size: 4;
}

Screenshot 2023-04-06 at 9 51 13 PM

How to replicate the issue + URL

URL in the screenshot: https://github.com/refined-github/refined-github/blob/c470d8103ebc9aa02735d4c0cb72d543333c5c06/source/features/sync-pr-commit-title.tsx

"New Code Search and Code View" must be turned on under Feature preview.

Extension version

23.3.31

Browser(s) used

Chrome 111.0.5563.146 / macOS 13.3

@rakuzen25 rakuzen25 added the bug label Apr 6, 2023
@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2023
@fregante
Copy link
Member

fregante commented Apr 6, 2023

This is now a native GitHub feature that you can customize in your profile. Our feature only fills some gaps

@rakuzen25
Copy link
Author

rakuzen25 commented Apr 6, 2023

This is now a native GitHub feature that you can customize in your profile. Our feature only fills some gaps

I suppose this means I should disable the tab-size feature?

@fregante
Copy link
Member

fregante commented Apr 6, 2023

"Fills gaps" means that GitHub doesn't apply your setting in some cases so RGH does it for you. There's nothing to disable

@rakuzen25
Copy link
Author

"Fills gaps" means that GitHub doesn't apply your setting in some cases so RGH does it for you. There's nothing to disable

Yeah, I understand that, but the problem is that, after I've set my GitHub settings, RGH breaks in the code view (i.e. RGH overrides my GitHub settings). I cannot select code properly because the tab size is different between what is displayed and what I can select, if you refer to the screenshot above. I'm just not sure why this is being closed as not planned when it is clearly a bug with RGH…

@baod-rate
Copy link

baod-rate commented Apr 7, 2023

"Fills gaps" means that GitHub doesn't apply your setting in some cases so RGH does it for you

In the case of the new code view, RGH is "filling the gaps" incorrectly. The new textarea element doesn't have a data-tab-size attribute (it sets tab-size in the element's style attribute), and RGH overrides the tab-size with !important causing the mismatch between the two overlapping texts.

This issue should be reopened.

@baod-rate
Copy link

baod-rate commented Apr 7, 2023

This custom CSS seems to workaround the issue for now:

textarea#read-only-cursor-text-area {
  --tab-size: revert;
}

Edit: It doesn't work consistently. You're better off just setting tab-size explicitly until this is fixed:

textarea#read-only-cursor-text-area {
  --tab-size: 3;
}

@fregante
Copy link
Member

fregante commented Apr 9, 2023

Sorry I had misunderstood this report. This has now been hotfixed so you should get the fix the next time your browser fetches it (every 4 hours at most, needs a page reload afterwards)

@rakuzen25
Copy link
Author

Looks like it's working for me!

@baod-rate
Copy link

FYI, it looks like the hotfix is distributed, but the --tab-size is still incorrectly overridden for sizes not accounted for the in the current version of tab-size.css

image

I guess this will be fixed once #6480 has been merged and released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants