Skip to content

Conversation

@danedavid
Copy link
Contributor

@danedavid danedavid commented Feb 22, 2020

Closes #2467. Adds 2 new features, which are improvements to the t file finder:

  1. Repo-wide file finder shortcut (repo-wide-file-finder): Currently, GH supports the t shortcut only in paths with /blob or /tree in them. Added a hidden button with data-hotkey so that the t works throughout other tabs in the repo, (eg: Issues, Releases, etc.)

  2. Preserves search term in file finder (preserve-file-finder-term.tsx): The search term in file finder is persisted ( in local storage ) across file finder invocations. Also, the keys pressed immediately following the t are persisted in a buffer and added to the search term. If buffer is present, the buffer is used, otherwise the value from previous search is used.

Kindly review and let me know if the features need to be added elsewhere (README, etc.). Thanks!


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

@danedavid danedavid requested a review from fregante February 22, 2020 09:06
Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

Yesss! Thank you

@danedavid danedavid changed the title File Finder improvements WIP: File Finder improvements Feb 23, 2020
@danedavid
Copy link
Contributor Author

@fregante
PR updated after review. Couple of notes:

  • Repo-wide t works only from Issues & Pull Requests tab. This is because only those 2 are inside the pjax-container element given by Github. Since now we can be sure that FF is always loaded via pjax, I'm using a normal variable as buffer like you said
  • For text restoration, tried using Github's inbuilt js-session-resumable class. Unfortunately, adding the class didn't work out; probably the code that handles it runs before that, like you had hinted. So went with storing in sessionStorage.
  • Should have been 3 PRs, but initially didn't have the idea they were gonna be 3 different features. Hence single PR 😄

@danedavid danedavid changed the title WIP: File Finder improvements File Finder improvements Feb 23, 2020
@danedavid danedavid requested a review from fregante February 24, 2020 08:07
@danedavid danedavid force-pushed the enhancements/file-finder-improvements-2467 branch from dc09db2 to 7b4ff75 Compare February 24, 2020 12:48
@danedavid danedavid requested a review from fregante February 24, 2020 12:50
@fregante
Copy link
Member

Looks good so far! I’m not sure when I’ll get around testing the code though

Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

Looks great!

preserve-file-finder-term could have a quick gif similar to the one below (I used Licecap), showing the mouse clicking the back button.

@fregante
Copy link
Member

The interesting part is that GitHub already has a js-pjax-restore-captured-input class on the field but apparently it doesn't work. I guess/hope preserve-file-finder-term will have a short life.

@fregante
Copy link
Member

fregante commented Mar 5, 2020

I hope to see this merged soon, it's only missing descriptions and screenshots.

Maybe you can find an elegant way to say "if responsive view, append to body and add the sr-only class instead, so it works even if invisible.

This can be done in a later PR, perhaps, so this one is merged asap.

@danedavid
Copy link
Contributor Author

@fregante Yes, I'll look into the description & screenshots over the weekend.

@danedavid danedavid requested a review from fregante March 7, 2020 18:55
@fregante fregante changed the title File Finder improvements Add 3 file-finder-related features Mar 7, 2020
@fregante fregante merged commit ebc4b67 into refined-github:master Mar 7, 2020
@fregante
Copy link
Member

fregante commented Mar 7, 2020

I never thought this'd see the day!

@danedavid danedavid deleted the enhancements/file-finder-improvements-2467 branch March 9, 2020 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

"File Finder" improvements

2 participants