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

Focus field after using collapsible-content-button #3600

Merged
merged 2 commits into from
Sep 29, 2020
Merged

Focus field after using collapsible-content-button #3600

merged 2 commits into from
Sep 29, 2020

Conversation

cheap-glitch
Copy link
Member

Thanks for contributing! 🍄

  1. LINKED ISSUES: none

  2. TEST URLS: https://github.com/sindresorhus/refined-github/issues/new

While working on #3598 I noticed a small bug in collapsible-content-button.tsx: there was a few lines of code to restore the selection after wrapping it in a <details> tag, but it had no effect (at least on latest Firefox):
without-focus

This can be fixed by focusing the textarea before restoring the selection:
with-focus

@busches
Copy link
Member

busches commented Sep 29, 2020

Am I crazy or are the two gifs the same?

@cheap-glitch
Copy link
Member Author

Am I crazy or are the two gifs the same?

No, in the second one the text stays selected.

@fregante
Copy link
Member

Thanks! Can you always .focus before the .insert? If a field is not focused, that .insert will focus it and then restore the focus back to where it was.

@fregante fregante added the bug label Sep 29, 2020
@cheap-glitch
Copy link
Member Author

Thanks! Can you always .focus before the .insert? If a field is not focused, that .insert will focus it and then restore the focus back to where it was.

Done!

@fregante fregante changed the title Restore selection when wrapping text in <details> tag Focus field after using collapsible-content-button Sep 29, 2020
@fregante fregante merged commit 1bba83e into refined-github:master Sep 29, 2020
@cheap-glitch cheap-glitch deleted the restore-selection branch September 29, 2020 19:57
kidonng pushed a commit to kidonng/refined-github that referenced this pull request Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants