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

do we need to grab keyboard focus on SearchBar open? #216

Open
rmallah opened this issue Mar 21, 2018 · 7 comments
Open

do we need to grab keyboard focus on SearchBar open? #216

rmallah opened this issue Mar 21, 2018 · 7 comments
Assignees
Labels
question Further information is requested
Milestone

Comments

@rmallah
Copy link
Contributor

rmallah commented Mar 21, 2018

Hi I have a situation where the opening screen of an app has a SearchBox
which should start in open state. I have put persistent: true as i do not want
it to be closable.

I find that i am having to call open() explicitly to show the searchbox , firstly is it necessary ?

in doing so the inputbox grabs focus and the OSK in the mobile device opens . Subsequently
as soon as the app starts the keyboard also opens automatically. I am not sure if i have
erred somewhere , but i feel we should not forceActiveFocus() in open (Line: 105)

searchTextField.forceActiveFocus();

@plfiorini
Copy link
Member

If you set persistent: true the search bar will be automatically open but the text input won't be focused until you call open().

Try changing SearchBar.qml so that searchTextField.focus is true when persistent is true and see if the OSK is still open when the app starts.

@rmallah
Copy link
Contributor Author

rmallah commented Mar 22, 2018

If you set persistent: true the search bar will be automatically open but the text input won't be focused until you call open().

The above is the desired behavior i am looking for.lemme check if it is really so
i will try to do it in the demo itself.

@plfiorini
Copy link
Member

If it works then we can patch SearchBar.qml to do so.

@plfiorini plfiorini self-assigned this Mar 22, 2018
@plfiorini plfiorini added the question Further information is requested label Mar 22, 2018
@vimpostor
Copy link
Member

Is autofocus really something, that would make sense to be the default?
Like if we take a look at all sorts of Google pages, like inbox.google.com, docs.google.com or photos.google.com.
All of them have persistent search bars, but they don't autofocus.

@rmallah
Copy link
Contributor Author

rmallah commented Mar 28, 2018

I find that i am having to call open() explicitly to show the searchbox ,
firstly is it necessary ?

@plfiorini , and what about the above. Should not a persistent search box
start in an open state ? Or am i mistaken in my observation.

I have also worked a bit on the SearchBox.qml in past and i am not sure
if any of my changes broke it.

regds
mallah.

@rmallah
Copy link
Contributor Author

rmallah commented Mar 28, 2018

@plfiorini , Sorry i missed some of your comments that you made in this
thread , which i read now. I shall contribute a patch in a few days if participants
can wait , else anyone can go ahead .
regds
mallah.

@plfiorini
Copy link
Member

plfiorini commented Aug 29, 2018

I think the best way possible to implement this is to add the focus property to SearchBar as an alias to searchTextField.focus.

This way the default behavior is not changed, but users can force focus if they wish.

EDIT: Looks like it doesn't work. Doesn't work if I set focus: true to searchTextField
This needs further investigation, can't make it for 1.1

@plfiorini plfiorini modified the milestones: 1.1.0, Post 1.0 Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants