Closed Bug 740306 Opened 8 years ago Closed 8 years ago

Back button does not dismiss the keyboard in awesomebar


(Firefox for Android :: General, defect)

Not set



Firefox 14
Tracking Status
firefox13 --- fixed
firefox14 --- verified
blocking-fennec1.0 --- +


(Reporter: paul.feher, Assigned: Margaret)



(1 file)

Nightly Fennec 14.0a1 (2012-03-28)
Device: Samsung Nexus S
OS: Android 2.3.6

Steps to reproduce:
1. Perform a sync operation 
2. Tap on the bookmark section on awesome
3. Select any folder
4. Tap on the URL bar for the keyboard to appear
5. Tap the back button

The keyboard is dismissed.

You move up a folder level in the bookmarks UI.
Summary: Back button does not dismiss the keyboard → Back button does not dismiss the keyboard in awesomebar
This is tricky, since code was added in bug 700951 to explicitly not dismiss the keyboard, but I guess this wasn't considered at that point since this bookmarks folder UI didn't exist then. It seems to me we want to make a special case for when the user explicitly brings up the keyboard, but I'm not sure how we can track that.
blocking-fennec1.0: --- → ?
Attached patch patchSplinter Review
I tried using imm.isActive() to check if the keyboard was showing, but I found that it always returned true, which wasn't helpful. However, I found that hideSoftInputFromWindow returns a boolean to indicate whether or not it successfully hid the keyboard, so I decided to take advantage of that.

I also expanded this bug to cover cases where the user brings up the soft keyboard in the history tab. Since we're explicitly hiding the keyboard when the user selects the bookmarks/history tab, if it's showing in one of those tabs, the user must have brought it up, so I think it makes sense to make the back button hide it in that case.
Assignee: nobody → margaret.leibovic
Attachment #611078 - Flags: review?(mark.finkle)
Comment on attachment 611078 [details] [diff] [review]

>     public boolean onBackPressed() {
>+        // If the soft keyboard is visible in the bookmarks or history tab, the user
>+        // must have explictly brought it up, so we should try hiding it instead of
>+        // exiting the activity or going up a bookmarks folder level.
>+        if (getCurrentTabTag().equals(BOOKMARKS_TAB) ||
>+                getCurrentTabTag().equals(HISTORY_TAB)){

Feel free to let this on a single line. I'd rather have that than the indenting.

>         // also return false if mBookmarksAdapter hasn't been initialized yet.
>         if (!getCurrentTabTag().equals(BOOKMARKS_TAB) ||
>                 mBookmarksAdapter == null)

Can you roll this up on a single line too?

Your logic makes sense to me. Let's see if this handles the current situation well enough.
Attachment #611078 - Flags: review?(mark.finkle) → review+
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 14
Comment on attachment 611078 [details] [diff] [review]

[Approval Request Comment]
User impact if declined: Inconsistent back button behavior in the awesome screen
Testing completed (on m-c, etc.): Landed on m-c 3/31
Risk to taking this patch (and alternatives if risky): Low risk, mobile-only change
Attachment #611078 - Flags: approval-mozilla-aurora?
Comment on attachment 611078 [details] [diff] [review]

[Triage Comment]
Low risk, mobile-only Fennec fix. Approved for Aurora 13.
Attachment #611078 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Verified/fixed on:
Nightly Fennec 14.0a1 (2012-04-04)
Device: HTC Desire
OS: Android 2.2.2
blocking-fennec1.0: ? → +
You need to log in before you can comment on or make changes to this bug.