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

Auto-focus search box in Add Tag window when external keyboard is attached? #688

Open
dstillman opened this issue May 16, 2023 · 7 comments
Assignees

Comments

@dstillman
Copy link
Member

https://forums.zotero.org/discussion/105027/enhancement-for-ios-auto-focus-on-the-tag-search-field-when-searching-tags

I haven't tested with an external keyboard, but if this wouldn't interfere with tapping, this would make it easier to just start typing.

@mvasilak
Copy link
Contributor

mvasilak commented Jun 19, 2023

I tested with the MacBook keyboard connected to an iPad, and I cannot understand what is the exact issue.
I very easily can press tab to switch focus to visible textfields, therefore tag search is 1 or 2 keystrokes away,
since by default it's visible in the tags pane.

Does the user mean something else, e.g. pressing the search button in the external keyboard, and the default behavior (showing the spotlight search in the iPad) is overridden to focus on an app search field instead? Could we ask them for some more info, ideally a video presenting the issue?

@dstillman
Copy link
Member Author

They might just not know you can press Tab, and I imagine many people wouldn't think of that. Regardless, I think the request would still be for the pane to start with focus in the search field when a keyboard is attached. Maybe there's an argument for consistency — we wouldn't focus the text field for all users — but it seems reasonable to prioritize a text field in some situations when a keyboard is attached.

@mvasilak
Copy link
Contributor

Since the Search Items field is also visible by default, perhaps it's this one that should gain focus. Ideally we could track the last search field used, and give focus to that one.

@dstillman
Copy link
Member Author

dstillman commented Jun 20, 2023

No, this is just for adding tags. We wouldn't do this for the items list — there's a whole UI you might interact with in that view.

@dstillman
Copy link
Member Author

Wait, I think this is a misunderstanding. This isn't about the tag selector in the bottom left. It's about the popup when you tap "Add tag" in the item details view.

@mvasilak
Copy link
Contributor

Did some research, and there are some solutions with different pros and cons:

  • Simply make the search field the first responder, either every time the view did appear, or just for the first time. This will work independently of the type of keyboard, and may not be ideal for those that just don't need to search.
  • Use https://developer.apple.com/documentation/gamecontroller/gckeyboard to get notifications when an external keyboard did connect/disconnect. However, w/ no immediate access to an actual external keyboard for iPad, it cannot be tested precisely. Simulator "keyboard dis/connection" doesn't always work as expected...
  • Use https://developer.apple.com/documentation/uikit/uigesturerecognizer/1619995-pressesbegan to detect when a physical button has been pressed, and make then first responder the search field. The caveat is that while it works ideally, unless the user tries it they won't know it is possible, because the focus won't be in the search field.

I'll try to get an external keyboard to properly test. Any feedback until then is welcome.

@dstillman
Copy link
Member Author

Eh, if this isn't easy, we can just forget about this. It really doesn't matter. And hopefully Tab focuses the first text field anyway.

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

No branches or pull requests

2 participants