On iOS (physic devices and in the chrome development tools) iOS throws errors when an input field get the focus and have to type attribute not set to text, so for example on email or number.
It doesn't always do that. Sometimes is happens directly and sometime after a few or more times the input gets the focus.
I have created a very simple screen with only a form, a div and an input.
I have created a movie so you can see what happens.
The JavaScript error is:fastclick.js?11_12_0_29969:342 Uncaught DOMException: Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('email') does not support selection.
at FastClick.focus (https://maykers-dev.outsystemsenterprise.com/PlayIt_JO/Widgets/Form/fastclick.js?11_12_0_29969:342:17)
at FastClick.onTouchEnd (https://maykers-dev.outsystemsenterprise.com/PlayIt_JO/Widgets/Form/fastclick.js?11_12_0_29969:597:8)
at HTMLBodyElement.<anonymous> (https://maykers-dev.outsystemsenterprise.com/PlayIt_JO/Widgets/Form/fastclick.js?11_12_0_29969:114:37)
In the Javascript with the line of the error there is this code in fastclick.js:
FastClick.prototype.focus = function(targetElement) {
'use strict';
var length;
// Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
length = targetElement.value.length;
targetElement.setSelectionRange(length, length);
} else {
targetElement.focus();
}
};There is already a comment about iOS 7 here. This code should be expanded for also of input with type set to email,number and maybe more I think.
Hi,
I had made a support call about it and OutSystems is happy I notificed them about this problem and will look for a fix because there seems to be a workaround they can implement in their code of OutSystems Web UI. (RPM-1949)
Kind regards,
Johan
Hi @Johan den Ouden ,
Thank you for the report! It appears that is an issue from the fastClick.js library itself.
It seems it's already reported, so we will need to wait on that.
Does this has any impact on the runtime experience of your app?
Best regards,
Bernardo Cardoso
Hi @Bernardo Cardoso ,
It was reported in 2015, 7 years... So I don't think it will be fixed.
We have no runtime experience of the web application other than people get errors in the console.log.
Why is OutSystems using a library with an issue that's not fixed in seven years. Is there no better library to use?
Thanks for your reply.
Hi @Johan den Ouden,
I don't really have the context about that decision, and it's not even something on the scope of the OutSystems UI Web framework.
However, fastClick has been used for several years in the platform, so I believe that at the time that was decided , it was the standard solution to avoid delay on touch interactions (mainly for iOS).
I will try to follow-up internally about this!
Bernardo
Great, let's hope your issue can be fixed then!
In any case, I found out that the fastclick.js usage was removed on the Platform Server 11.14.0, at least for Mobile Apps, so it might also be removed in the future for traditional ones.