Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24348] iOS: keyboardToolbar fails to disappear with external keyboard

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionNot Our Bug
Resolution Date2017-01-27T19:22:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterTim Poulsen (ACV)
AssigneeHans Knöchel
Created2017-01-26T21:00:05.000+0000
Updated2017-03-24T19:00:50.000+0000

Description

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.

Attachments

FileDateSize
close_and_open_line_in_app_720.jpg2017-01-26T20:57:49.000+000084570
test_field_toolbar.zip2017-01-27T19:21:22.000+000028229

Comments

  1. Hans Knöchel 2017-01-27

    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.
  2. Hans Knöchel 2017-01-27

    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.
  3. Tim Poulsen (ACV) 2017-01-27

    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.
       // where done the Done button & tf is the text field
       done.addEventListener('click', function () {
       	tf.blur();
       	toolbar.hide();
       });
       
       tf.addEventListener('focus', function () {
       	toolbar.show();
       });
       
       tf.addEventListener('blur', function () {
       	toolbar.hide();
       });
       
  4. Lee Morris 2017-03-24

    Closing ticket with reference to the previous comments.

JSON Source