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

Select search expression on Ctrl+F #7932

Closed
afruehstueck opened this issue Feb 26, 2020 · 7 comments
Closed

Select search expression on Ctrl+F #7932

afruehstueck opened this issue Feb 26, 2020 · 7 comments
Labels
good first issue status:resolved-locked
Milestone

Comments

@afruehstueck
Copy link

@afruehstueck afruehstueck commented Feb 26, 2020

In virtually every IDE, if you hit Ctrl+F, the search field opens with the previous content selected, such that when you Ctrl+F and start typing, you can directly input a new search expression.

In contrast, in Jupyterlab, the content will not be selected, which leads to a frustrating user experience.

Reproduce

Here's a minimal demonstration of the behavior:
jupyterlab

Expected behavior

I suggest the behavior gets adjusted such that the search text is selected on Ctrl+F.

@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Feb 26, 2020

Excellent idea, thanks for opening an issue.

Here is where, for example, the find is opened and focused:

app.commands.addCommand(startCommand, {

Perhaps this "focusInput" method can be changed to select the text?

I think here is where the focusing actually happens, and what would need to change to select the text when focusing:

componentDidUpdate() {
if (this.props.forceFocus) {
this.focusInput();
}
}
which leads to
focusInput() {
(this.refs.searchInputNode as HTMLInputElement).focus();
}

Setting this as a good first issue. Would you like to try submitting a PR?

@SlowMonk
Copy link

@SlowMonk SlowMonk commented Feb 28, 2020

which version this issue going to be fixed?

@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Feb 28, 2020

which version this issue going to be fixed?

It's an open issue for anyone who wants to submit a PR. Would you like to contribute this fix? We can help you get set up to do the development.

misterbeebee added a commit to misterbeebee/jupyterlab that referenced this issue Mar 23, 2020
Focus-with-select when focusing Search box (Issue jupyterlab#7932)

https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement

Old: `focus()`	Focuses on the input element; keystrokes will subsequently go to this element.
New: `select()`	Selects all the text in the input element, and focuses it so the user can subsequently replace all of its content.
@misterbeebee
Copy link
Contributor

@misterbeebee misterbeebee commented Mar 23, 2020

I've started a PR #8073, but I don't have a test environment set up yet. I might have one later.

If anyone has an automatically integrating test environment set up, this is a simple change to merge in and test.

@misterbeebee
Copy link
Contributor

@misterbeebee misterbeebee commented Mar 23, 2020

Automatic testing of PR #8073 failed, but I can't see how failures are caused by this PR.

jasongrout added a commit that referenced this issue Mar 24, 2020
Focus-with-select when focusing Search box (#7932)
@GabrielFritz
Copy link

@GabrielFritz GabrielFritz commented Apr 4, 2020

Hi, is there anyone working on this? I'd like to work on it as my first issue!

@misterbeebee
Copy link
Contributor

@misterbeebee misterbeebee commented Apr 4, 2020

This is fixed.

@github-actions github-actions bot added the status:resolved-locked label Feb 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue status:resolved-locked
Projects
None yet
Development

No branches or pull requests

6 participants