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

Issue #196 - Remove old FF workaround setTimeout #199

Merged
merged 8 commits into from
Jun 5, 2019

Conversation

cornu-ammonis
Copy link
Contributor

@cornu-ammonis cornu-ammonis commented Jun 2, 2019

Fixes #196

Confirmed via testing that this does not change add-on behavior. Also ran all tests. Bugzilla seems to confirm that the target of this workaround was resolved with FF 60.

Copy link
Owner

@rugk rugk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cornu-ammonis,
thanks for your first contribution to this project! 🎉 👍 🏅
I hope you'll like this project and enjoy hacking on it… 😃

So:

  • generally, it all seems to work, indeed, at least the text selection
  • the "scroll to the top" does not really work as it seems. However, i also saw it did not really work before that PR here…
    This generally seems to be a little fragile though…

What this seems to break though is:

  • when select text and use the context menu "create QR code" it now then does not select all the text anymore

Note that this happens likely because of that hard timings that happen when the UI is opened and several promises that race against each other. Stuff in InitQrCode
But I guess I'll have to tackle this anyway, somehow… so I'll certainly have a look here.

BTW in order to test scrolling to top, just use a long URL with some # at the end, e.g. https://longextendedsubdomainnamewithoutdashesinordertotestwordwrapping.badssl.com/#sdfhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhaklshdiowhaodew902123423423423432erasd

@@ -184,13 +174,7 @@ function scrollToTop(event) {
return;
}

// Attention: make sure this does not collide with the retry-property set
// in selectAllText()!
event.setScrolled = true;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't even re-try scrolling to the top, I guess we can remove all that setScrolled logic too, can't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rugk I agree! But I think there is still a setTimeout for that one here, should we take that out too?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question and I am not sure. Is this still needed? Possibly not…?

Or possibly it is, considering "scroll to top" does not work anyway always in the current situation in my testing at least.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rugk yeah, seems like that may call for a larger refactor

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, fine, accepted. Also opened a different issue for that now: #203

Copy link
Owner

@rugk rugk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also SELECT_TEXT_TIMEOUT is set, but unused now. As per our contributing guide, try to use ESLint.

@todo

This comment has been minimized.

So it also runs the selection code now when the text at initialisation is overwritten by a context menu message.
@rugk
Copy link
Owner

rugk commented Jun 2, 2019

BTW you can (automatically) let issues close when a PR is merged with the right keyword (i.e. remove "issue" in your PR description).

@cornu-ammonis
Copy link
Contributor Author

Also SELECT_TEXT_TIMEOUT is set, but unused now. As per our contributing guide, try to use ESLint.

Ah my bad, will do! Excited to contribute!

This likely does not make things better, because when the QR code changes it's size, this also affects the scroll position of the whole textarea.

So we better do it at the end, as we did before.
@rugk rugk force-pushed the remove-old-ff-workaround branch from bf6a7b9 to 5041d0a Compare June 2, 2019 20:58
Copy link
Owner

@rugk rugk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I've also changed some things to fix that the selection was not properly triggered when you use the context menu in the add-on.

Also another issue:
When you click inside of the input field, it does not always select the whole text automatically:
gifSelectionIssue

There is an event listener that should force it to select all the text then: https://github.com/rugk/offline-qr-code/pull/199/files#diff-817dd83d26bd35283a14722780bb8481R516

Again, it seems this issue is present in the current master, anyway, so it may not be solvable in this PR.

@cornu-ammonis
Copy link
Contributor Author

So I've also changed some things to fix that the selection was not properly triggered when you use the context menu in the add-on.

Also another issue:
When you click inside of the input field, it does not always select the whole text automatically:
gifSelectionIssue

There is an event listener that should force it to select all the text then: https://github.com/rugk/offline-qr-code/pull/199/files#diff-817dd83d26bd35283a14722780bb8481R516

Again, it seems this issue is present in the current master, anyway, so it may not be solvable in this PR.

Hmm yeah, does seem like some race stuff. I agree probably out of scope for this PR, but happy to file another issue and see if I can figure it out! Thanks for the comments / additions here!

@cornu-ammonis
Copy link
Contributor Author

Also SELECT_TEXT_TIMEOUT is set, but unused now. As per our contributing guide, try to use ESLint.

removed!

@rugk
Copy link
Owner

rugk commented Jun 5, 2019

happy to file another issue and see if I can figure it out!

Done: #202

@rugk rugk merged commit d721eb2 into rugk:master Jun 5, 2019
@rugk
Copy link
Owner

rugk commented Oct 3, 2019

BTW, currently there is the new Hacktoberfest 2019 running. Any PR there counts (if it is made in October). 😃
So if you still want to figure out the reason for #202, maybe now is the time, @cornu-ammonis… 😉

You may also have a look at all issues tagged with "hacktoberfest" in this repo or somewhere else.

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

Successfully merging this pull request may close these issues.

Test whether auto-select retry is still needed with Firefox >= 60
2 participants