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

Fix for "find searches only part of the file" bug #6905

Merged
merged 9 commits into from
Jun 12, 2023

Conversation

ericsnekbytes
Copy link
Collaborator

As suggested in #6697, this PR enables the Jupyter Document Search shortcut as a default behavior, so that users will get it by default instead of the browser find tool (Lab and Notebook 7 now only render visible-on-page content in the DOM, so the browser find is not going to work for file content outside the visible/viewport range).

@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

Binder 👈 Launch a Binder on branch ericsnekbytes/notebook/find_fixes

@jtpio
Copy link
Member

jtpio commented Jun 8, 2023

bot please update playwright snapshots

@jtpio jtpio added this to the 7.0 milestone Jun 8, 2023
@jtpio jtpio closed this Jun 8, 2023
@jtpio jtpio reopened this Jun 8, 2023
@@ -6,7 +6,7 @@
"command": "documentsearch:start",
"keys": ["Accel F"],
"selector": ".jp-mod-searchable",
"disabled": true
"disabled": false
Copy link
Member

Choose a reason for hiding this comment

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

Since these settings only include the keyboard shortcut override, maybe we could actually remove the whole file?

@jtpio
Copy link
Member

jtpio commented Jun 8, 2023

Thanks @ericsnekbytes for working on this!

I left a small suggestion above to clean up unused settings files, but otherwise should be good to go. Maybe we can also mention this in the documentation as part of this PR?

@jtpio
Copy link
Member

jtpio commented Jun 8, 2023

cc @yuvipanda for awareness since you had originally commented on this on the RetroLab issue: jupyterlab/retrolab#294 (comment)

As explained in #6697, the motivation for reverting this change is the new virtual implementation of the notebook in JupyterLab (and in Notebook 7). Some cells might not be visible on the page until they are in the viewport.

If we keep the shortcut disabled, then the browser search bar is still triggered on Ctrl-F but it might not be possible to find some text in the notebook document.
However with this PR, hitting Ctrl-F opens the JupyterLab search bar and we can search the entire notebook.

So with this PR it's mostly a matter of changing the default. Users who still want the browser search (even though it would not work on hidden elements) would have to disable the shortcut via the settings.

@jtpio jtpio mentioned this pull request Jun 8, 2023
Your browser's `find` function will give unexpected results because it doesn't have
access to the full content of a document, but you can still use your browser find
function from the browser menu if you want, or you can disable the intelligent search
shortcut using the advanced settings editor. TODO: DETAILS (investigate settings bug?)
Copy link
Member

Choose a reason for hiding this comment

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

Should we track this TODO in an isssue?

Copy link
Member

Choose a reason for hiding this comment

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

And if it's a more general issue about settings maybe we can track it on the JupyterLab repo directly: https://github.com/jupyterlab/jupyterlab

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jtpio I've verified that the settings JSON schema that shows up in the advanced settings editor is different than your sample video. The issue is that I don't know the expected schema for the JSON object being edited, and thus how to explain how to disable the shortcut to a user.

There's also the matter of explaining to users what a JSON object is and what a key/value pair is, on top of where those go in the schema to properly disable the shortcut...this is more content that should be communicated in a docs entry. At this point I'm wondering if simply acknowledging the behaviors of intelligent-search and browser-search (which is already done in the docs in this PR) is enough for now...we can merge this in and worry about docs for disabling later. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

simply acknowledging the behaviors of intelligent-search and browser-search (which is already done in the docs in this PR) is enough for now...we can merge this in and worry about docs for disabling later.

Yes, and this is likely something to address in JupyterLab actually.

But it would be nice to not leave the TODO in the docs before merging.

Copy link
Collaborator Author

@ericsnekbytes ericsnekbytes Jun 9, 2023

Choose a reason for hiding this comment

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

@jtpio That's done, I'm opening a new PR for Lab too and will link it here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same docs updates for JupyterLab are at: jupyterlab/jupyterlab#14667

@jtpio jtpio linked an issue Jun 9, 2023 that may be closed by this pull request
Copy link
Contributor

@andrii-i andrii-i left a comment

Choose a reason for hiding this comment

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

Thank you for working on this @ericsnekbytes. This looks good to me. Please find a suggestion on capitalization for consistency below.

docs/source/notebook.md Outdated Show resolved Hide resolved
@jtpio jtpio marked this pull request as ready for review June 12, 2023 06:06
Copy link
Member

@jtpio jtpio left a comment

Choose a reason for hiding this comment

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

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find text only searches part of file
3 participants