Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java

Issue 2877003002: (Android) Fix Bluetooth keyboard focus issues in settings (Closed)
Patch Set: Android: Only allow focus on JS AlertDialog messages with enough text to scroll Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java
index 97a68d330ee3a1404db8d99c71f9504d6c8d4117..d93ea96758fd19f9c19edb70c855beceb257d116 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/JavascriptAppModalDialog.java
@@ -142,6 +142,21 @@ public class JavascriptAppModalDialog implements DialogInterface.OnClickListener
layout.findViewById(R.id.js_modal_dialog_scroll_view).setVisibility(View.GONE);
} else {
((TextView) layout.findViewById(R.id.js_modal_dialog_message)).setText(mMessage);
+
+ layout.findViewById(R.id.js_modal_dialog_message)
+ .addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
+ @Override
+ public void onLayoutChange(View v, int left, int top, int right, int bottom,
+ int oldLeft, int oldTop, int oldRight, int oldBottom) {
+ final View scrollView =
+ layout.findViewById(R.id.js_modal_dialog_scroll_view);
+ int messageHeight = bottom - top + scrollView.getPaddingTop()
+ + scrollView.getPaddingBottom();
+ boolean isScrollable = scrollView.getHeight() < messageHeight;
+
+ scrollView.setFocusable(isScrollable);
+ }
+ });
}
}
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/ModalDialogTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698