material-components / material-components/material-components-android
[MaterialAlertDialogBuilder] Vertical background insets are too large when soft keybard is shown
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 17.4k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
MaterialAlertDialogBuilder defines a bigger vertical margin for dialogs via attributes backgroundInsetTop and backgroundInsetBottom
The default is defined via dimens mtrl_alert_dialog_background_inset_top and mtrl_alert_dialog_background_inset_bottom to be 80dp on normal screens with portrait orientation. This is generally fine, but gives an unfortunate result when the soft keyboard is shown and reduces the dialog height.
Compare the appcompat builder with the material builder with the keyboard hidden:


and the keyboard shown:


While the appcompat dialog is perfectly usable, the material dialog is too small, and makes the dialog difficult to use, in the case of this example hiding too much of the content from the user.
I do not know if this can be achieved by using configuration qualifiers, but ideally the vertical inset should react to the available window height taking the presence of the soft keyboard into account.
**Material Library version:** 1.9.0 and 1.10.0-alpha03
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at MaterialAlertDialogBuilder and the backgroundInsetTop/backgroundInsetBottom attributes, including the mtrl_alert_dialog_background_inset_top and mtrl_alert_dialog_background_inset_bottom dimensions. Reproduce the dialog with and without the soft keyboard, then determine how the insets should respond to the available window height; done means the material dialog remains usable when the keyboard is shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- design, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100