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

Text input field is not always scrolled to top #203

Closed
rugk opened this issue Jun 5, 2019 · 6 comments · Fixed by #228
Closed

Text input field is not always scrolled to top #203

rugk opened this issue Jun 5, 2019 · 6 comments · Fixed by #228
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@rugk
Copy link
Owner

rugk commented Jun 5, 2019

Bug description

Also discovered in #199

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to https://longextendedsubdomainnamewithoutdashesinordertotestwordwrapping.badssl.com/#sdfhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhaklshdiowhaodew902123423423423432erasd
  2. Open the QR code popup…

Actual behavior:

image

The scroll bar is at the bottom, it's scrolled down.

Expected behavior:

Scroll bar should be at the top, i.e. it should display the beginning of the URL.

More details:

  • Do also test different ways to trigger the QR code popup with large data. Ctrl+A and use the context
  • Also test the setting in the options "Automatically use text selected on website.".

The reason that you need to test this is, that all three ways work differently in passing/getting the data to the QR code popup panel. They e.g. trigger at different times and you can expect race conditions or so…

FYI: opening via hot key is (should be) the same as via click/no difference is expected here.

System

Operation system and version: Linux/Fedora 30/GNOME
Browser and version: Firefox 69
Add-on version: 1.6

Further information

Responsible function:

function scrollToTop(event) {

For a solution, I may be fine with refactoring this (it's kinda needed) and possibly split it into it's own file (module). (together with some other text selection things there…)

@rugk rugk added bug Something isn't working help wanted Extra attention is needed labels Jun 5, 2019
@rugk
Copy link
Owner Author

rugk commented Oct 25, 2019

@Rad0n You took this issue on. Could you also explain how you think the PR fixes the issue?
If I re-read this now, maybe this was a timing/race issue? Actually, I think the promises should hopefully be properly chained, so the scrolling is only triggered after the text is set.

I.e. when you use too much text this may just be the origin issue: The generation takes too long and the text selection/scrolling correction is already triggered.

@Rad0n So did you also test the bug as described above? Or in another ways?

@pradyumnamahajan
Copy link
Contributor

Yes it was a timing issue and now that i think of it, a promise will be even better.

What I have done is increased the TOP_SCROLL_TIMEOUT so that it will always have enough time to scroll to top(which was not happening with 10 ms)

I did test it with other long URLs and with "Automatically use text selected on website" on and it worked with both of them :)

@rugk
Copy link
Owner Author

rugk commented Oct 25, 2019

that it will always have enough time

Bold statement 😜
"Always" statements in programming and when fixing timing issues are always very critical… 😜

But, if it works, it's all right… 😄

I did test it with other long URLs and with "Automatically use text selected on website" on and it worked with both of them :)

Okay, great so… 😄

@pradyumnamahajan
Copy link
Contributor

Hahaha yeah poor choice of words :P
It worked well even with 15 ms for my machine so I set it to 20 ms but tell me if you want to be more cautious and set it higher.

@pradyumnamahajan
Copy link
Contributor

@rugk any other changes you want me to make? would love to help :) #hacktober

@rugk
Copy link
Owner Author

rugk commented Oct 27, 2019

You may have a look at all issues tagged with "hacktoberfest" in this repo or somewhere else. (Of course, however, you can take any issue on. "help wanted" is also a good task if you want to contribute something possibly more difficult, but really useful)

@rugk rugk closed this as completed in 74cb4c0 May 31, 2020
rugk added a commit that referenced this issue May 31, 2020
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 Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants