material-components / material-components/material-components-android

[MaterialAutoCompleteTextView] Dropdown height calculated incorrectly when added to a dialog

Open
#3,307 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: TextView
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:**

When `MaterialAutoCompleteTextView` is added as a custom view to a dialog, the dropdown height does not account for the IME. A good portion of the dropdown items end up below the keyboard.

**Expected behavior:**

In this screen recording, the last few items in the dropdown are obscured by the keyboard, but should ideally not happen.

https://user-images.githubusercontent.com/646253/225210028-4d8b37eb-94f8-4f44-8be2-952f7e4ec1d4.mp4

**Source code:**

This can be reproduced with a small modification to the official catalog app in this repo.

1. Clone this repo (I was testing against `master` at commit 359580b6c1160301967ebdededb1011c1133b42c)
2. Apply this patch: https://gist.github.com/chenxiaolong/e3e163d1e1b8b3cb7a56f4fb4af19131
* This modifies the "Custom View" dialog sample to have a `MaterlaAutoCompleteTextView` and increases the number of dropdown elements to 25
3. Navigate to Dialogs -> Demo -> Custom View
4. Tap on the text box
5. The dropdown items are obscured by the keyboard

**Android API version:** 33

**Material Library version:** Both 1.8.0 and `master` (commit 359580b6c1160301967ebdededb1011c1133b42c) exhibit this issue

**Device:** Google Pixel 7 Pro (Android 13 build `TQ1A.230205.001.D2`)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the official catalog app through Dialogs -> Demo -> Custom View, using the described MaterialAutoCompleteTextView modification and Android API 33 setup. Start at MaterialAutoCompleteTextView's dropdown-height calculation and inspect how the IME is accounted for; done means the dropdown items remain visible above the keyboard in the dialog.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.