-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] Add a done button to text fields #24645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] Add a done button to text fields #24645
Conversation
@kubaflo is your description for another PR? It says ripple and button, but the PR is for iOS and Done. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Editor already has this logic in Core, should this rather be added there as a feature? |
@mattleibow my bad 😅 I initially copied and pasted from this PR: #23599 |
@mattleibow Yes that's right, editors have this button always enabled |
@PureWeen maybe this is better in Core for all Entry instances? Also, what if the user wants to hide from Editor? We added this for Editor without a way to disable, so maybe we need to come up with an API or something for net9.0? |
@tj-devel709 You are our resident "text entry" person/expert/guru... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a chat with some folks, I think this is worth making into an actual feature. We already do this for Editor, so making this work the same for Entry is a better thing.
Could this PR be updated to rather be a .NET 9 feature that basically always adds the Done button to Entry - just like we have in Editor.
No problem, I will do it soon! |
4b0c77c
to
8915404
Compare
@mattleibow done :) |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
8915404
to
bed21f5
Compare
/azp run |
|
/rebase |
b3953c0
to
d90f0bb
Compare
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a "Done" button to text fields and editors on iOS by implementing a reusable input accessory view. This addresses user experience issues where keyboards without dedicated "Done" buttons (such as Numeric, Plain, and Telephone keyboards) make it difficult for users to dismiss the keyboard, especially when tapping outside doesn't hide it.
- Refactors existing editor "Done" button functionality into reusable extension methods
- Adds "Done" button support to Entry controls (previously only available for Editor)
- Creates consistent behavior across both Entry and Editor controls for keyboard dismissal
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/Core/src/Platform/iOS/TextViewExtensions.cs | Adds extension method to attach Done accessory view to UITextView with editor-specific completion handling |
src/Core/src/Platform/iOS/TextFieldExtensions.cs | Adds extension method to attach Done accessory view to UITextField with entry-specific completion handling |
src/Core/src/Handlers/Entry/EntryHandler.iOS.cs | Updates Entry handler to use new Done accessory view extension method |
src/Core/src/Handlers/Editor/EditorHandler.iOS.cs | Refactors existing Done button code to use new extension method |
Comments suppressed due to low confidence (1)
src/Core/src/Platform/iOS/TextViewExtensions.cs:193
- The variable name 'entryHandler' is misleading since this is in TextViewExtensions and handles IEditorHandler. It should be renamed to 'editorHandler' for clarity.
if (sender is IEditorHandler entryHandler)
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kubaflo can you fix tests on this one and rebase?
d90f0bb
to
f804c01
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
f804c01
to
7e1aa80
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this. We can always add a opt-in/opt-out for it later!
Description of Change
When specifying Keyboard="Numeric/Plain/Telephone", the resulting keyboard on iOS lacks a dedicated "Done" button, making it difficult for users to dismiss the keyboard. This issue is further exacerbated by the fact that sometimes tapping outside the keyboard does not automatically hide it, leading to a frustrating user experience.
Issues Fixed
Fixes #24644
Fixes #19550
Fixes #29370
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-09-07.at.12.50.48.mp4