Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6367] Android: searchBar.blur() - v8/rhino - Blurring search bar attempts to hide soft KB but fails

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-06-21T10:42:15.000+0000
Affected Version/sRelease 1.7.5, Release 1.8.0.1
Fix Version/sRelease 3.1.0, 2012 Sprint 24, 2012 Sprint 24 API
ComponentsAndroid
Labelsapi, kitchensink, qe-testadded
ReporterEric Merriman
AssigneeHieu Pham
Created2011-11-29T17:11:49.000+0000
Updated2013-06-21T10:42:15.000+0000

Description

Description: In KitchenSink, in Controls>Search bar, blurring the search bar should dismiss the soft kb if it's onscreen but does not. A visible movement of the KB is perceived as it starts to dismiss, but does not actually complete the process. It remains on screen. The workaround is to hide the field and then attempt to blur. THe KB will be removed from the screen. Steps to reproduce: 1) Install KS with 1.8.0.1 2) Navigate to Controls>Search bar 3) Click on the search to bring up the soft KB 4) Click the cancel button or click the "blur search bar" Result: KB moves slightly as if it will move offscreen, but the KB remains on screen Expected: KB is removed from the screen Note: Also Occurs With 1.7.5 GA

Comments

  1. Eric Merriman 2011-11-29

    The same behavior occurs with the KS test: Controls>text area>Basic
  2. Eric Merriman 2011-12-15

    Also occurs with Controls>Test Field>Events with SDK 1.8.0.1.v20111214093905 on Both Xoom and LG Slate
  3. Arthur Evans 2012-02-21

    This also means that there seems to be no way to use the built-in cancel button on the search bar. It doesn't generate a 'blur' event, so there's no way to know when it's been pressed in order to use Eric's workaround. In the following test case, note that: 1) No matter what I do, the 'blur' event is not generated. 2) Clicking the "Cancel" button does not clear the search field, blur the search field, or close the onscreen keyboard. 3) The Back button will close the onscreen keyboard, but there doesn't seem to be any way to clear the text in the search bar short of erasing it one character at a time.
       Ti.UI.setBackgroundColor('#000');
       
       var win = Ti.UI.createWindow({
         title:'Tableview with Filter',
         backgroundColor:'#fff'
       });
       
       function makeRow() {
           // generate random string of digits and capital English letters
           // see http://en.wikipedia.org/wiki/Base_36
           return Ti.UI.createTableViewRow({
               title: Math.random().toString(36).substring(7)
           });
       }
       var searchbar = Ti.UI.createSearchBar({
           showCancel: true,
           hintText: "This is the hint text",
       });
       searchbar.addEventListener('blur', function(e) {
       	Ti.API.info("Blur event called.");
       });
       searchbar.addEventListener('focus', function(e) {
       	Ti.API.info("Focus event called.");
       });
       var tbl = Ti.UI.createTableView({
       
           search: searchbar,
       });
       var data = [];
       for(var i=0; i<100; i++) {
           data.push(makeRow());
       }
       tbl.data = data;
       win.add(tbl);
       win.open();
       
  4. Arthur Evans 2012-02-21

    Correction to the above: blur seems to be fired in the emulator if: 1) I use the back button to close the keyboard, AND 2) I scroll down with the mouse scrollwheel. However, just clicking on a row outside of the search box doesn't blur the search box.
  5. Arthur Evans 2012-02-21

    Update: looking into the Kitchen Sink issues, I think they're not the same issue. I think what we have in the Kitchen Sink is a sample issue, caused by the fact that there is no other focusable control on screen, so as soon as the search bar is blurred, it gets focus again by default. I opened a new bug for the issues I reported above: TIMOB-7748.
  6. Hieu Pham 2012-12-04

    master PR: https://github.com/appcelerator/titanium_mobile/pull/3515
  7. Anshu Mittal 2013-03-01

    Tested with: SDK:3.1.0.v20130228145653 Studio: 3.1.0.201302252142 Device: Samsung tab(v 3.2) works as expected.
  8. Anshu Mittal 2013-06-21

    Reopening to update labels

JSON Source