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

Add closing button to search/replace bar #3645

Open
brandinchase1 opened this issue Aug 18, 2024 · 10 comments
Open

Add closing button to search/replace bar #3645

brandinchase1 opened this issue Aug 18, 2024 · 10 comments
Labels
UI/UX User Interface, user experience

Comments

@brandinchase1
Copy link

Your idea:

When you open the search or replace bar (Ctrl+F and Ctrl+Shift+F respectively) there is no way that I could find to close the search bar.

@dbolack-ab
Copy link
Collaborator

The search bar responds to the escape key or by clicking outside of it on my system. Is it behaving differently for you?

@brandinchase1
Copy link
Author

I tried escape and it worked. And I retried it and clicking outside of it works as well. I have just had a couple instances where it doesn't go away when clicking and I'm not sure how to replicate it now. At the very least, it might be helpful to add an close button or a note mentioning the escape key

@Gazook89
Copy link
Collaborator

Maybe one day we can utilize the openDialog addon for codemirror to make a fancier search box: https://codemirror.net/5/doc/manual.html#addon_dialog

@brandinchase1
Copy link
Author

2024-08-17.22-04-22.mp4

I found a way to replicate it

@Gazook89
Copy link
Collaborator

Gazook89 commented Aug 18, 2024

Ah, so if you highlight (edit: CLICK INTO) the search tip text, you can't click or esc to close the search box. Weird.

@brandinchase1
Copy link
Author

You can use either but you have to click back in the search bar before you are able to. And I didn't know that esc was an option so it wasn't really intuitive for me to click back on the box. I also know that it blocks the first line of text so when I was trying to edit my first line it was more of problem.

@Gazook89
Copy link
Collaborator

I was impressed that you were able to get your editor window to be scrolled so close to the end of your text. I can't get my scroll to anything less than ~4 lines of text, no matter how i scrunch and stretch my window or how many lines of text i have. It seems it's possible to position the search box at the bottom as just an option on the Codemirror Search library, so maybe we could do that.

That said, it seems like it is a bug/oversight on the codemirror 5 library itself. I looked through the Search library source but couldn't spot exactly how the dismissal of the sear box works or where i'd tweak it.

Others can chime in, but my gut feeling is that this is not likely going to be fixed unless someone spots a really easy fix.

@brandinchase1
Copy link
Author

Do you think we could intercept this line somehow and modify the cm.phrase to include "Hit escape to close"

https://github.com/codemirror/codemirror5/blob/48d159a49b1db89523df7834cb18b46ac142764b/addon/search/search.js#L210

@Gazook89
Copy link
Collaborator

I don't think that really solves the problem, though. If clicking anywhere else on the screen doesn't dismiss it as probably 99% of people would expect, that means it's already too late for hitting esc-- doing so won't do anything. So it'd be more confusing that it isn't working. You'd need a note that says "if you can't dismiss this, click back into the search box and then click anywhere else".

The only really fix I think is to make it so it is dismissable regardless of whether the search box is in focus or not.

@5e-Cleric 5e-Cleric added the UI/UX User Interface, user experience label Sep 6, 2024
@5e-Cleric
Copy link
Member

We could add a closing button to it, it is using the space for one after all, a little X button at the end should be no problem.

@5e-Cleric 5e-Cleric changed the title Ability to close search / replace bar Add closing button to search/replace bar Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI/UX User Interface, user experience
Projects
None yet
Development

No branches or pull requests

4 participants