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

Improve keyboard dismiss #17

Merged
merged 2 commits into from
Sep 5, 2023
Merged

Improve keyboard dismiss #17

merged 2 commits into from
Sep 5, 2023

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Sep 2, 2023

Improve keyboard dismiss

♻️ Current situation & Problem

This PR addresses the issues described in #16 where keyboard dismiss would accidentally hit other buttons in the UI and was not able to handle differing submit labels.

💡 Proposed solution

This PR rewrites the dismissKeyboard method to cover all currently defined SubmitLabels and employs some heuristic to cover the case where a new submit label is added without our knowledge.
Further, this PR proposes to remove the code handling the "swift to type" tutorial (explained here #16 (comment)). I found in my testing that even on completely erased simulator devices this tutorial doesn't pop up anymore. Consequentially, I couldn't verify an implementation that would work in that case. I don't have information that verifies my theory that this popup isn't there anymore for simulator devices, but propose that we tackle this once we can reproduce this popup again. The current implementation produces way more false inputs than it handles the actual problem.

⚙️ Release Notes

  • Improved the dismissKeyboard() method.
  • Fixed an issue where the text input methods would accidentally tap arbitrary Done or Continue buttons.

➕ Additional Information

Related PRs

--

Testing

Test were updated and extended.

  • Added regression tests by placing multiple buttons to the text entry tests and verify that they are not accidentally pressed.
  • Added explicit tests for text field focus and keyboard dismiss.

Reviewer Nudging

Code changes should be minimal.

Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@codecov
Copy link

codecov bot commented Sep 2, 2023

Codecov Report

Merging #17 (6786b17) into main (625477e) will decrease coverage by 2.22%.
The diff coverage is 72.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #17      +/-   ##
==========================================
- Coverage   89.26%   87.03%   -2.22%     
==========================================
  Files           9        9              
  Lines         307      316       +9     
==========================================
+ Hits          274      275       +1     
- Misses         33       41       +8     
Files Changed Coverage Δ
...stExtensions/XCUIApplication+DismissKeyboard.swift 62.50% <65.00%> (-37.50%) ⬇️
...urces/XCTestExtensions/XCUIElement+TextEntry.swift 92.37% <100.00%> (+0.37%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 625477e...6786b17. Read the comment docs.

@Supereg
Copy link
Member Author

Supereg commented Sep 2, 2023

The only code section not covered is a fallback in the case that new submit labels or unknown submit labels are used. I would assume that this is expected and hard to cover right now.
Therefore, I would request you admin power @PSchmiedmayer once approved 🚀

Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

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

Thank you @Supereg! 🚀

@PSchmiedmayer PSchmiedmayer merged commit 388a6d6 into main Sep 5, 2023
7 of 8 checks passed
@PSchmiedmayer PSchmiedmayer deleted the fix/keyboard-dismiss branch September 5, 2023 16:21
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