Skip to content
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

[SuperTextField][iOS] Don't show the mobile toolbar upon first tap (Resolves #2005) #2019

Merged
merged 3 commits into from
May 25, 2024

Conversation

angelosilvestre
Copy link
Collaborator

[SuperTextField][iOS] Don't show the mobile toolbar upon first tap. Resolves #2005

On iOS, tapping to focus the textfield is showing the toolbar. Looking at some iOS app, it seems the toolbar should only be displayed on tap if the textfield already has focus.

This PR changes the iOS textfield to only show the toolbar on tap if it already has focus.

For Android, it seems that doesn't show the toolbar even if the textfield already has focus.

@@ -293,6 +294,45 @@ class SuperTextFieldInspector {
"Couldn't find the caret rectangle because we couldn't find a SuperTextField. Finder: $superTextFieldFinder");
}

/// Returns `true` if the mobile text field is configured to display a toolbar.
Copy link
Contributor

Choose a reason for hiding this comment

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

Both the name of this method, and the documentation confuses me. I don't know what "is configured to display a toolbar" means, nor do I know what "wantsMobileToolbarToBeVisible" means. Can you please revisit those to help the reader understand what they're querying here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They mean that the overlay controller has shouldDisplayToolbar set to true. I didn't documented as if this guarantees that the toolbar is actually displayed because we are not checking for any widgets in the tree...

Copy link
Contributor

Choose a reason for hiding this comment

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

Then should we check for widgets, instead? Is there a reason that you chose to lookup a property variable rather than verify the actual toolbar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In SuperEditor, the toolbar builder provides a Key for the user to attach to the toolbar. With that key we can find the toolbar widget.

In SuperTextField, there is no provided key that apps can attach to the toolbar. Since the toolbar is fully in control of the app we don't have a easy way to query the toolbar widget.

A possible solution would be to wrap the toolbar with another widget that we could easily find...

Copy link
Contributor

Choose a reason for hiding this comment

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

Since the toolbar is fully in control of the app we don't have a easy way to query the toolbar widget.

Can you clarify what that means?

We're talking about tests, right? Our tests decide what to build for the toolbar, and our tests should be able to find whatever toolbar they create, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed to override the toolbar builders, so we can check if the toolbar widget is present. Unfortunately, we cannot configure this at SuperTextField level, so I had to create SuperAndroidTextField and SuperIosTextField directly.

Copy link
Contributor

@matthew-carroll matthew-carroll left a comment

Choose a reason for hiding this comment

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

LGTM

@matthew-carroll matthew-carroll merged commit dcbb991 into main May 25, 2024
11 checks passed
@matthew-carroll matthew-carroll deleted the 2005_dont-show-toolbar-first-tap branch May 25, 2024 23:25
quaaantumdev pushed a commit to quaaantumdev/super_editor that referenced this pull request Jun 1, 2024
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.

[SuperTextField][Mobile] - Popover toolbar appears when it shouldn't
2 participants