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

Feature request: place cursor in textbox when renaming files #215

Open
dagwud opened this issue May 26, 2021 · 2 comments
Open

Feature request: place cursor in textbox when renaming files #215

dagwud opened this issue May 26, 2021 · 2 comments

Comments

@dagwud
Copy link

dagwud commented May 26, 2021

Really small and silly request, but the "Rename" menu brings up a popup to prompt for the file name, but the caret is not placed in the new file name text box. I initially raised this issue against the addon but was referredreferred here by Frenck

A small usability fix (putting the cursor in the text box to allow you to just start typing) would be nice. When doing housekeeping and renaming a bunch of files, this extra click is pesky.

Environment

HAOS 5.13
core-2021.5.5
supervisor-2021.04.3

Steps to reproduce:

Open File Editor
Click the "Browse Filesystem" icon
Click on the "..." next to any file name
Click Rename
Note the popup which asks "Please enter a new name for " - if you just start typing, nothing happens as the cursor is not placed in the input box

@dagwud dagwud changed the title Feature request: place cursor in textbox renaming files Feature request: place cursor in textbox when renaming files May 26, 2021
@dagwud
Copy link
Author

dagwud commented May 26, 2021

Hi

Looking at the code, it seems like perhaps there’s space for a neat little global fix - it looks like all pop ups with a text input have the same minor issue (eg Create New File and Create New Folder too)

I’m not familiar enough with the setup process to be able to build locally so I haven’t raised a PR with a change, but an idea (if you want it): perhaps this could be a write-once-fixed-everywhere thing. Perhaps via JS - if the modal contains only one child and it’s an input-text, then $(input).focus(); when displaying the modal

@danielperna84
Copy link
Owner

Sadly I seem to fail to implement this. I have tried adding things like dd_rename_a.addEventListener("click", function() {document.getElementById('rename_name_new').focus();}, false); to the link-element (the buttons are created programmatically). I know the code gets executed. But it does not focus the input. I assume that's happening because the focus is applied before the element is drawn on the screen, and then other stuff is happening, thereby changing the focus to something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants