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
Open
Make sure dictation button is not hidden on android when the focused field is inside a modal#918VegardHV wants to merge 2 commits into
VegardHV wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
⚠️ 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/EditorHandlerto attach the dictation overlay to the focused native view instead of the current activity. - Refactor
DictationKeyboardOverlayto 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(); | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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