sindresorhus/refined-github

Expanding of New Issue Textarea Causes Scroll Jumping #3994

karlhorky posted onGitHub

<!-- Thanks for reporting a bug! ā›° 1. Make sure the bug is caused by Refined GitHub. Try disabling the extension first. 2. Include a full URL where the bug appears. 3. Include a screenshot/gif Issues without a URL/screenshot will be closed -->

Hi there @bfred-it ! šŸ‘‹ Hope you are well.

There is an issue with long textareas (first added in https://github.com/sindresorhus/refined-github/pull/1871 ) and scroll jumping when entering a newline with enter / return.

Repro steps:

  1. Go to https://github.com/sindresorhus/refined-github/issues/new?assignees=&labels=bug&template=bug_report.md
  2. Copy all of the text and paste 20 or so times, creating a very long textarea
  3. Click to the end of one of the lines and press Return (enter)
  4. The scroll position will jump so that the cursor is at the very top of the viewport šŸ˜«

Kapture 2021-02-18 at 12 53 46

Browser: Chrome latest 88.0.4324.182 OS: macOS latest (Big Sur 11.2.1)

I can't reproduce this on https://fregante.github.io/fit-textarea/


I can't reproduce this on Firefox with RGH 21.1.9, what browser are you using?

posted by cheap-glitch about 4 years ago

Ah sorry, forgot to add the browser info - added it now above. Chrome latest + macOS latest.

posted by karlhorky about 4 years ago

In case there is no logic in Refined GitHub itself, wonder if this is related to the Scroll Anchoring behavior that Chrome has that is supposed to keep the page from shifting:

https://blog.chromium.org/2017/04/scroll-anchoring-for-web-developers.html

posted by karlhorky about 4 years ago

This feels like an error in GitHubā€™s own logic for bulled point lists. fit-textarea does not affect the cursor and I donā€™t remember any other feature that handles the enter key.

posted by fregante about 4 years ago

bulled point lists

Hmm... do you think that it still applies though when it's not a bullet list? I was not in a bullet point list there...

posted by karlhorky about 4 years ago

bulled point lists

Hmm... do you think that it still applies though when it's not a bullet list? I was not in a bullet point list there...

I can confirm this has nothing to do with the actual content of the textarea. As OP said this is probably caused by a scrolling behavior specific to Chrome.

posted by cheap-glitch about 4 years ago

Itā€™s not super clear from the gif because of the repeating content, but due to how fit-textarea works, it might actually be its fault.

I thought that only the cursor was changing position (index) in the field, but actually the whole page scrolls, right?

Normally fit-textarea takes care of that and always tries to restore the scroll afterwards.

Just try disabling the feature in Refined GitHub to ensure its the culprit. GitHub actually has a similar but limited feature included, so double check separately by completely disabling the extension.

posted by fregante about 4 years ago

Just try disabling the feature in Refined GitHub to ensure its the culprit.

I did this before submitting the issue - GitHub itself does not have the "endlessly expanding" textareas. They even have a max-height to prevent resizing of the textarea.

posted by karlhorky about 4 years ago

If I disable the extension and then manually disable the max-height and expand the textarea horizontally, it doesn't appear to happen...

Kapture 2021-02-19 at 11 25 02

But not sure if it would maybe be intermittent...

posted by karlhorky about 4 years ago

Just try disabling the feature in Refined GitHub to ensure its the culprit.

I did this before submitting the issue

So that means youā€™re sure that fit-textarea is the culprit here. Iā€™ll have to look into it

posted by fregante about 4 years ago

It seems like it, but I guess it's not 100% certain that it's not something with Chrome that needs to be worked around separately...

posted by karlhorky about 4 years ago

I can replicate it in Chrome, without Refined GitHub:

gif

I'm pretty sure it's what my first comment said šŸ˜ because it only happens for some content, like the numbered lists present in the new issue template.

Unknown

posted by fregante about 4 years ago

Jokes aside, no worries, and thanks for opening a detailed issue. By the way now I'm @fregante, not @bfred-it šŸ˜

posted by fregante about 4 years ago

Hmm... then how is it happening with the first example (which is not in a list)? Is it detecting that the cursor is inside a comment?

posted by karlhorky about 4 years ago

And, if this is an issue with GitHub itself, would it be possible to fix this in Refined GitHub? That would make the extension even more useful...

posted by karlhorky about 4 years ago

Hmm... then how is it happening with the first example (which is not in a list)?

Probably they see the hyphen and are trying to handle it as a list. There are other situations where it seems the enter key is mishandled. For example if I select this paragraph and press enter the text is not deleted like youā€™d expect.

And, if this is an issue with GitHub itself, would it be possible to fix this in Refined GitHub? That would make the extension even more useful...

Fixing this would require us to rewrite the whole ā€œpress enter to continue listā€ logic which Iā€™d rather leave to GitHub. I suggest reporting both of these issues to them.

posted by fregante about 4 years ago

I suggest reporting both of these issues to them.

When I first read this a few days ago, I agreed with this.

But I was about to report just now, and thinking about it more, it will probably be a wontfix for them, because it only happens when a user is using the Refined GitHub extension (the textarea does not get a super large height applied ever in normal GitHub).

So I guess since Refined GitHub won't do this change since it's potentially a bit bigger, and I don't think GitHub is going to change their code for an extension, I guess this will just stay as a "known issue".

posted by karlhorky about 4 years ago

it only happens when a user is using the Refined GitHub extension

As I said when I closed the issue, it doesnā€™t. Look at the last gif I posted, thereā€™s no Refined GitHub. The mouse movement highlights the lack of checkmark that RG adds next to the repository name and the existence of the Insights tab, that RG removes.

This is 100% unrelated to this extension.

posted by fregante about 4 years ago

As I said when I closed the issue, it doesnā€™t. Look at the last gif I posted, thereā€™s no Refined GitHub.

Ah, I must have missed / forgotten that detail, sorry. Then maybe it does make sense to still report it. Although the UX isn't as bad when the textarea is smaller...

posted by karlhorky about 4 years ago

Ok, at first I was unable to reproduce this without Refined GitHub enabled, but then I was able to narrow down the behavior a bit:

  1. As I demonstrate at the start of the video, the bug does not appear right away. I hit enter at the end of some lines, and no scroll position change can be observed.
  2. To reliably trigger the buggy scroll jumping behavior, you need to add a list to the issue text (I only tested a numbered list). Add one list item with some text after it, and then hit enter to create a second empty list item. Click to the end of the first line with something in it, scroll so that the list is flush with the bottom of the textarea, and then hit enter. This will create a new line item and trigger the buggy scroll behavior.
  3. From this point on, until you delete the list items, the buggy scroll behavior can be observed when hitting enter at the end of any line with content in it (also just on ordinary paragraphs outside of list items)
  4. To disable the buggy behavior again (I show this at the end of the video), delete the numbered list, and TWICE go to the end of some line and hit enter. The first time, it will show the buggy scroll behavior, but after the second time it will go back to normal.

Here's a video of the behavior: https://www.youtube.com/watch?v=3FrtTNYXMvI

I'll submit a support request to GitHub.

posted by karlhorky about 4 years ago

Fund this Issue

$0.00
Funded

Pull requests