Page MenuHomePhabricator

[L] Native editor Voice Over support
Closed, ResolvedPublic

Description

PR: https://github.com/wikimedia/wikipedia-ios/pull/4521
PR: https://github.com/wikimedia/wikipedia-ios-components/pull/9 (since we've already migrated to a monorepo, this work will need porting over)

Requirements:

  • Add feature flag
  • Add container view controller around source editor component
  • Adds localized and Voice Over accessibility strings injection
  • Adds unit tests and UI tests
  • Ensure init sites updated with injected localized strings

Engineering notes #1 [PR: https://github.com/wikimedia/wikipedia-ios/pull/4521] :

This PR adds the native editor feature flag and implements the initial pieces of it within PageEditorViewController. I also added a full source edit button in ArticleViewController, so that we can test performance against a large set of wikitext as we build this. The entry point of this full source edit button is likely to change before release, though.

Note I found a bug in the default automatic theme switching in this branch. Marking as draft while I look into that.

Test Steps
In the Staging scheme, load the article editor, either by tapping the full source "Edit" button at the top of an article or any edit pencil.
Text formatting toolbars and input views should display like our Code Mirror editor, though state logic in the Find and Replace toolbar view will act wrong. I will fix this in a separate find & replace PR later on.

Engineering notes #2 [PR: https://github.com/wikimedia/wikipedia-ios-components/pull/9] :

This PR does a few things:

Updates the source editor components to reference a WKSourceEditorLocalizedStrings struct of strings instead of internally hardcoding them. This will allow us to inject localized strings from our client app.

Note that though the struct is injected at the public view model init point, I am referencing the strings internally like a singleton (label.text = WKSourceEditorLocalizedStrings.current.inputViewParagraph). I felt like it was nice to have the localized strings for a whole feature in one easy to read (though large) struct, instead of split up across several different view models. Referencing the singleton internally also allowed me to avoid passing the strings around everywhere in method parameters throughout the feature, which felt distracting. But it still feels a bit weird and could cause potential reuse issues down the line, so I'm definitely open to changes here.
This also adds Voice Over accessibility labels everywhere, using the same pattern.

This adds unit tests and UI tests that can be run locally (WKSourceEditorTests and WKSourceEditorUITests). Note that there isn't any CI set up for this, but maybe we can discuss adding Xcode Cloud integration if we like these. For UI tests, I had to add accessibility identifiers on certain elements, which were added in a similar pattern as WKSourceEditorLocalizedStrings.

This PR is ready to review, but is a breaking change against the client app and how wikimedia/wikipedia-ios#4521 is instantiating the source editor. Since that PR is already in progress, I am marking this PR as draft until that is merged.

Testing Notes

The only thing testable with this chunk of work is Voice Over support - everything else here foundational has already been tested in the other tickets.

Event Timeline

This task is splitting out already initiated under T331936 that is currently already going through code review.

Seddon renamed this task from [Task] Native editor feature flag and container view controller to [Task] Native editor feature flag, container view controller and components.Oct 3 2023, 1:22 AM
Seddon updated the task description. (Show Details)
Tsevener added a subscriber: Mazevedo.

Can be tested in TestFlight Experimental build 7.4.6 (60).

Not much user-facing here besides Voice Over support for all the keyboard buttons. I'm going to move this into Needs Design Review.

@OTichonova Something we need to know is what Voice Over accessibility labels you would like for all of the keyboard buttons.

For example:

In our current editor, the bold button says "Add Bold Formatting, button" for an unselected state, and "selected, Remove Bold Formatting, button" for a selected state.

The Notes app says "Bold, button" when in an unselected state, and "selected, Bold, button" when in a selected state.

Hi @Tsevener,
Looking through Slack and Notes apps I think we can get rid of 'add' and/or 'remove' and have it as you mentioned above so it is not redundant when selecting options from the text formatting menu.

I am wondering whether it might be helpful to have it slightly different when selecting text formatting options from the toolbar rather than the menu. We can have 'Bold text formatting, Button' and 'selected, bold text formatting, button' when people tap the options from the toolbar. Eg. When you double tap and select a word you will have 'bold' and 'italics' as options in the toolbar.

The thought process being:

  • When people select the text formatting menu it reads it out to you, but you don't have that added context when you are selecting these options directly from the toolbar above the keyboard.

Links: 'Writing great accessibility labels'

Tsevener raised the priority of this task from Low to Medium.Jan 19 2024, 9:41 PM
Seddon renamed this task from [Task] Native editor feature flag, container view controller and components to [L] Native editor feature flag, container view controller and components.Jan 25 2024, 6:27 PM

Hi @Tsevener!
This might be an issue on my side but I noticed that when voiceover is on and I either switch to the app, go back to the editor after opening and closing 'Find and replace' and/or 'insert media' the editor freezes for multiple seconds and I can't tap anything. You can see in the videos times that there are times when the cursor is just blinking but nothing is happening those are the times when I was tapping but the app wasn't responding.

Switching over to the app-> Video

Going back to the editor after opening and closing 'Insert media' -> Video

@OTichonova It does seem to hang for me on my lowest powered device when I edit a full article source. It's better when I'm editing only a section, so I'm guessing it just takes a while for Voice Over to evaluate the text view data. I might be able to do some sort of "loading editor" announcement before it switches back to the editor.

I also notice the image wizard seems to still think the editor text view is displaying after it appears. I can look at that too. Let me know if you see any other oddities.

Hi @Tsevener, okay sounds good with the 'loading editor'. I will take at look at it today again.

Improvements will be in the next Experimental build (81).

Code is merged, but we may tweak Voice Over label wording some more from feedback. Waiting on confirmation there.

Tsevener renamed this task from [L] Native editor feature flag, container view controller and components to [L] Native editor Voice Over support.Feb 8 2024, 9:20 PM
Tsevener updated the task description. (Show Details)

Update: Voice Over label tweaks will happen as a part of a separate task.

ABorbaWMF subscribed.

Looking good from my side on 7.4.7 (3162)

JTannerWMF claimed this task.