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

Enable file-finder-buffer everywhere #4441

Merged
merged 2 commits into from Jun 8, 2021
Merged

Enable file-finder-buffer everywhere #4441

merged 2 commits into from Jun 8, 2021

Conversation

cheap-glitch
Copy link
Member

Fixes #4159

Test URLs

Any repo page, including this one.

Screenshot

capture-1622712596.mp4

@@ -35,7 +35,7 @@ function pjaxStartHandler(event: CustomEvent): void {
<span className="flex-self-stretch mr-2">{bufferField}</span>
);
bufferField.focus();
for (const element of select.all('.pagehead-actions, .rgh-ci-link, .octotree-bookmark-btn')) {
for (const element of select.all('.pagehead-actions, .rgh-ci-link details, .octotree-bookmark-btn')) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Since .rgh-ci-link is applied to the wrapper around the title, this was effectively removing the whole thing (including the inserted buffer).

@@ -11,7 +11,7 @@ async function init(): Promise<void> {
<a
hidden
data-hotkey="t"
data-pjax="true"
data-pjax="#js-repo-pjax-container"
Copy link
Member Author

Choose a reason for hiding this comment

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

Setting the data-pjax attribute to true caused the hotkey to trigger a "real" navigation instead of an AJAX one, so the handlers added by file-finder-buffer weren't called.

This is probably because the element is inserted outside the main "container" (as opposed of the native hotkey which is located on the "Go to file" button).

Fixed it by changing the value of the attribute, mimicking the native link in the repo name heading:

<a data-pjax="#js-repo-pjax-container" href="/sindresorhus/refined-github">refined-github</a>

But this could also probably be fixed by inserting the link element directly inside the container.

@cheap-glitch cheap-glitch marked this pull request as ready for review June 3, 2021 09:43
@yakov116 yakov116 requested a review from fregante June 8, 2021 02:40
@fregante fregante added the bug label Jun 8, 2021
@fregante fregante changed the title Fix: file-finder-buffer should work on the same pages as repo-wide-file-finder Enable file-finder-buffer everywhere Jun 8, 2021
@fregante fregante merged commit 6f27970 into refined-github:main Jun 8, 2021
@cheap-glitch cheap-glitch deleted the extend-file-finder-buffer branch June 8, 2021 06:24
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.

file-finder-buffer should work on the same pages as repo-wide-file-finder
2 participants