Skip to content

Make sure dictation button is not hidden on android when the focused field is inside a modal#918

Open
VegardHV wants to merge 2 commits into
mainfrom
vhv/android-place-dictation-button-above-modals
Open

Make sure dictation button is not hidden on android when the focused field is inside a modal#918
VegardHV wants to merge 2 commits into
mainfrom
vhv/android-place-dictation-button-above-modals

Conversation

@VegardHV

Copy link
Copy Markdown
Contributor

Description of Change

The dictation microphone now shows above the keyboard when the focused field is in a modal or a bottom sheet, instead of being hidden behind it.

Todos

  • I have tested on an Android device.
  • I have tested on an iOS device.
  • I have supported accessibility

Copilot AI review requested due to automatic review settings July 24, 2026 14:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Not ready to approve

The sample toggles a global Android window soft-input mode without restoring it, which can impact keyboard behavior across the Components app after leaving the sample.

Pull request overview

This PR updates the Android dictation keyboard overlay so the microphone popup is hosted in (and positioned relative to) the focused field’s window rather than always using the activity window. This prevents the microphone from being obscured when focus is inside a modal or a bottom sheet.

Changes:

  • Switch EntryHandler / EditorHandler to attach the dictation overlay to the focused native view instead of the current activity.
  • Refactor DictationKeyboardOverlay to bind insets tracking and popup positioning to the host window (decor/content view) of the focused field.
  • Extend the Components sample to open dictation fields in a modal and a bottom sheet, and add a soft input mode toggle for testing; add changelog entry.
File summaries
File Description
src/library/DIPS.Mobile.UI/Components/TextFields/Entry/Android/EntryHandler.cs Attach dictation overlay to the focused native view on focus.
src/library/DIPS.Mobile.UI/Components/TextFields/Editor/Android/EditorHandler.cs Attach dictation overlay to the focused native view on focus.
src/library/DIPS.Mobile.UI/Components/TextFields/Dictation/Android/DictationKeyboardOverlay.Positioning.cs Update positioning to use the focused field’s host window decor view.
src/library/DIPS.Mobile.UI/Components/TextFields/Dictation/Android/DictationKeyboardOverlay.cs Rework overlay lifecycle to rebuild per activity but bind/rebind per host window.
src/app/Components/ComponentsSamples/TextFields/KeyboardDictation/KeyboardDictationSamplePage.xaml.cs Add modal/sheet open actions and Android soft input mode toggle for testing.
src/app/Components/ComponentsSamples/TextFields/KeyboardDictation/KeyboardDictationSamplePage.xaml Add UI controls for opening modal/sheet and toggling soft input mode.
src/app/Components/ComponentsSamples/TextFields/KeyboardDictation/DictationModalSamplePage.xaml.cs Add modal sample code-behind.
src/app/Components/ComponentsSamples/TextFields/KeyboardDictation/DictationModalSamplePage.xaml Add modal sample UI containing dictation-capable fields.
src/app/Components/ComponentsSamples/TextFields/KeyboardDictation/DictationBottomSheet.xaml.cs Add bottom sheet sample code-behind.
src/app/Components/ComponentsSamples/TextFields/KeyboardDictation/DictationBottomSheet.xaml Add bottom sheet sample UI containing dictation-capable fields.
CHANGELOG.md Document the Android dictation overlay fix.

Review details

  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Low

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment on lines +7 to +13
private bool m_softInputResizes = true;

public KeyboardDictationSamplePage()
{
InitializeComponent();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants