IOS steals focus from first input element for some reason - ios

working on a React/Material-UI based series of forms. The autofocus HTML property works as expected, but for some strange reason the page, upon load, is stealing focus away from the first text field, and applying it somewhere in the middle.
This is especially annoying since I have validation onBlur, which will throw up a little error message saying to the user that the first field needs to be filled out. How do I keep iOS Safari from stealing that focus?

I had a similar problem to this using TextField with multiline set to true (rendering a <textarea>). I'm not sure why, but I was able to narrow it down to a minHeight that I had set on the textareaStyle prop for TextField. My problem showed up on both iOS and Safari so I'm guessing it's got to do something with webkit. Removing the minHeight rule solved my issue of the focus being stolen.

Related

Predicitve text/suggestion above keyboard doesn't work?

My whole Xcode project has a weird behaviour,dont know what is causing this issue I am getting prediction and suggestions above my keyboard, but when I click on the text it doesn't call any method or when I try clicking on the predicited text it doesn't work.
is there by chance because of using third party pods?have tried all types of textContentType I get suggestion like name,phonenumber,otp but unfortunately when I tap on it it doesn't work
its behaviour is literally like the predicition has user interaction disabled

Why does Android ViewPager2 looses focus when switching between tabs?

I have a ViewPager2 on my Android App. One of the pages contains an EditText field.
The scenario I encountered is as follows:
Set focus on the text field -> keyboard shows
Switch to another page -> keyboard dismisses (the field lost focus)
Go back to the previous tab and set focus on the text field again -> the field will gain focus but immediately the focus would clear. Tapping on the field again will get the focus back.
I prepared a small demo app to demonstrate this issue: https://github.com/hilaza/SwitchTabsBugDemo
I debugged it and what I found was that the ViewPager clears the focus from my page, thinking that a page was selected. Debugging it further I saw that it has something to do with the RecyclerView's didChildRangeChange method which wrongly assumes that something has changed.
Does anyone happen to know why it's happening and what can I do to work around this?
This is a strange bug happens because of Recycler behaviour. Unfortunately, cannot explain why it happens, but know for sure that this row might help you:
pager.offscreenPageLimit = 1
Or the equivalent in Java. This may help because it disables some of Recycler behaviour. Will be happy if someone explains it better. Faced the same issue and resolved it with this one.

Sometimes text_field and css scroll don't work on mobile device

Ruby : 2.3.1
Rails: 5.2.2
I make a responsive web application and have encountered unacceptable bugs.
I searched for various things, but I couldn't find a person who encountered the same bug.
▪️Detail
The following bugs sometimes occur when using an application:
Sometimes, It doesn't focus into the field even if I tap text_field, email_field and text_area.
"a tag on html" still works. It seems tap function is not wrong.
Visit to form page.
Tap text_field, email_field and text_area.
Sometimes, it doesn't focus.
Sometimes the bug is fixed after having left time or visiting another page although I'm not sure.
▪️Inspect
I checked the above bugs below:
・mobile phone emulator(device toolbar of chrome devtools)
・ios(12.1.2)
・Android(8.0.0)
Also, when the bug appears, scroll doesn't work only on the actual mobile device, both of ios and Android.
Does anyone have an idea?
I solved it by my self.
▪ cause
There was a page handling JS touch event, but because the scrolling function wasn't added in that event.
There was a bug that scroll couldn't be done on the above page.
When transitioned to another page that has text_field via scroll bug page, it seemed that scroll bug remained because of turbolinks.
And text_field didn't work.
I found that text_field bug was fixed by followings:
when reloaded the page.
when transitioned to the page via a tag with data-turbolinks =
"false".
At first I fixed scroll bug on touch event page.
And then text_field bug was also fixed.
Also, when the above bug comes out, there is a bug in which scroll
does not work only on the actual machine of mobile. There is no
problem with the emulator.
This was completely my misunderstanding, even the bug occurred in the emulator too.

IOS: Text Selection in WKWebView (WKSelectionGranularityCharacter)

I've got an app that uses a web view where text can be selected. It's long been an annoyance that you can't select text across a block boundary in UIWebView. WKWebView seems to fix this with a property on its configuration: selectionGranularity. One of the possible values is WKSelectionGranularityCharacter:
Selection endpoints can be placed at any character boundary.
Sounds great! Exactly what I need. Except that when I set that in my web view, I often can no longer select text at all. What is going on? Is there something else I need to set? Has anyone figured this out?
Update: I've figured out the following bugs:
When there is more than one WKWebView in an app with selectionGranularity set to WKSelectionGranularityCharacter, only the most recent one to load can select text. I've filed this as bug 18441138.
If there is a click handler attached to an element inside the body in the HTML content of a WKWebView whose selectionGranularity is set to WKSelectionGranularityCharacter, text selection doesn't work inside that element. I've filed this as bug 18440833.
Text selection fails in the WKWebView after you've entered edit mode on a UITextView somewhere else in the app until the WKWebView reloads. I've filed this as bug 18468405.
Has anyone worked around any of these?
These and other issues are all fixed as of iOS 13.
There are several known bugs that are still not fixed.
You can execute JavaScript to get selected text as a workaround.
window.getSelection().toString()
Docs

iPad text input and text selecting not working properly

This will be difficult to explain so I won't paste any code.
I'm implementing a wysiwyg editor on my site called wysihtml5 and there are several issues when selecting the textarea/editor with the iPad. On a desktop browser, all is fine, the text can be selected, edited, pasted etc. But on the iPad multpiple issues occur:
Can't tap anywhere in the text to move the cursor there
If I manually move the cursor, all of a sudden I can't type anything anymore
Tapping outside of the texteditor doesn't bring the keyboard down
Basically I'm just hoping there's someone who has had similiar experiences with iPad cursor not behaving correctly in text input fields and what possible solutions there might be. I'm stuck and have no idea how to debug this.
Did you use touch event? iOS has a bug: you can't input in editable iframe if you are listening(or had listened) any touch event(touchstart, touchmove...), I tested this bug occurs even you listen other elements but iframe itself. yes, it's a serious bug, you can check out:
wysihtml5 issues98

Resources