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
Native Editor - VoiceOver improvements #4737
Merged
Merged
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
de540da
Add accessibility label for textview
tonisevener e768610
Add space for better wikitext reading
tonisevener 587962b
Fix bug where editor held focus after insert media flow appeared
tonisevener 2010796
Announce that editor is loading text to break up voice over hang
tonisevener d08f35f
Fix Voice Over bug where edit notice mid-body text was read first
tonisevener 597b4d0
Fix tests
tonisevener 8eb9ad3
Merge branch 'main' into voice-over-improvements
staykids 082d4b0
PR Feedback
tonisevener bc656d8
Merge branch 'main' into voice-over-improvements
tonisevener be14dc0
Fix tests
tonisevener 021a1f7
Merge branch 'voice-over-improvements' of https://github.com/wikimedi…
tonisevener File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,15 @@ fileprivate var needsTextKit2: Bool { | |
} | ||
} | ||
|
||
class WKSourceEditorTextView: UITextView { | ||
override func accessibilityActivate() -> Bool { | ||
|
||
UIAccessibility.post(notification: .announcement, argument: "Loading editor text.") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Patterning usage elsewhere, should we localize this argument string? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Good catch! |
||
|
||
return super.accessibilityActivate() | ||
} | ||
} | ||
|
||
@objc final class WKSourceEditorSelectionState: NSObject { | ||
let isBold: Bool | ||
let isItalics: Bool | ||
|
@@ -101,7 +110,7 @@ final class WKSourceEditorTextFrameworkMediator: NSObject { | |
let textView: UITextView | ||
if needsTextKit2 { | ||
if #available(iOS 16, *) { | ||
textView = UITextView(usingTextLayoutManager: true) | ||
textView = WKSourceEditorTextView(usingTextLayoutManager: true) | ||
textKit2Storage = textView.textLayoutManager?.textContentManager as? NSTextContentStorage | ||
} else { | ||
fatalError("iOS 15 cannot handle TextKit2") | ||
|
@@ -118,7 +127,7 @@ final class WKSourceEditorTextFrameworkMediator: NSObject { | |
layoutManager.addTextContainer(container) | ||
textKit1Storage?.addLayoutManager(layoutManager) | ||
|
||
textView = UITextView(frame: .zero, textContainer: container) | ||
textView = WKSourceEditorTextView(frame: .zero, textContainer: container) | ||
textKit2Storage = nil | ||
} | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Binary file modified
BIN
+248 Bytes
(100%)
Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings
Binary file not shown.
This file contains 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
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.
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.
It's an interesting situation we've backed ourselves into transiting localizations into Components through these structs and this pattern because of, in practice, how verbose and exploded our call sites become. 🤠 To be clear, I'm ok with this pattern because even though it's verbose, it's at least 100% clear about the components data needs over something like an arbitrary
Dictionary
. But it may be worth brainstorming a little during an eng. sync as a group to see if we can think of any cleaner alternatives (for the sake of the client call sites) in the future.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.
Agreed