After blurring a text field, its keyboard toolbar remains on the screen if you're using an external bluetooth keyboard. The same behavior is seen in the iPhone simulator if you use your computer's keyboard to enter text into the field then press Cmd+K to hide the virtual keyboard.
As shown in the attached screen from our production app, the toolbar can remain on screen even as you move throughout the app. Force-closing the app is the only way to remove the toolbar once it's stuck.
Reproduction steps:
1 - Create a Classic project with this code
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var cancel = Ti.UI.createButton({
systemButton: Ti.UI.iPhone.SystemButton.CANCEL
});
var flex = Ti.UI.createButton({
systemButton: Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});
var done = Ti.UI.createButton({
systemButton: Ti.UI.iPhone.SystemButton.DONE
});
done.addEventListener('click', function () {
console.log('done.click firing');
tf.blur();
});
var items = [];
items.push(cancel);
items.push(flex);
items.push(done);
var toolbar = Ti.UI.iOS.createToolbar({
items: items
});
var tf = Ti.UI.createTextField({
top: 100,
height: 44,
borderStyle: Ti.UI.INPUT_BORDERSTYLE_LINE,
hintText: "Use an external keyboard",
keyboardToolbar: toolbar
});
tf.addEventListener('focus', function () {
console.log('tf.focus firing');
});
tf.addEventListener('blur', function () {
console.log('tf.blur firing');
});
win.add(tf);
win.open();
2 - pair a bluetooth keyboard with an iPhone
3 - run the above app
4 - tap the text field to focus and display the keyboard
5 - on your keyboard, type some text
6 - tap Done or press Enter on the keyboard. The toolbar remains visible.
Alternate repro steps:
Run the above code on the iOS simulator
Focus the text field by clicking on it
Type something with your computer's keyboard (not the virtual keyboard)
Press Cmd+K to hide the virtual keyboard. The toolbar remains visible.
(Oftentimes tapping Done has it stick in the simulator, too.)
Perhaps related to TIMOB-15967 and/or TIMOB-6490. This might be an underlying Apple bug as I see some notes on StackOverlow that seem somewhat similar.
Hey Tim, actually I'm not sure if that's a Titanium-specific issue or an iOS one, because I remember that I had the same thing when testing a native app a few months ago. We need to make a native test-case for this and investigate the results. Putting into the sprint.
Attached a native Xcode project, it seems like it's the intended behavior from iOS (or an issue they should fix). I'll file a radar at Apple just in case, but resolving this ticket for now.
Thanks. I was thinking this might have been an Apple bug. For anyone reading this needing a workaround, manually hiding/showing the toolbar in the textfield's focus/blur events works.
Closing ticket with reference to the previous comments.