-
Notifications
You must be signed in to change notification settings - Fork 2
Добавил VoiceOver #1
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
base: main
Are you sure you want to change the base?
Conversation
akaDuality
left a comment
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.
Приложение с VoiceOver я тоже запустил, все хорошо. Молодец!
| refreshAccessibilityProperties() | ||
|
|
||
| let argument = email.isValid ? countStepper : emailTextField | ||
| UIAccessibility.post(notification: .layoutChanged, argument: argument) |
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.
Фокус вроде и так останется на поле емейла. Вроде можно попроще:
if email.isValid {
UIAccessibility.post(notification: .layoutChanged, argument: argument)
}
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.
Паша смотрел сегодня приложение, разобрал весь кейс, можно будет посмотреть в записи, иос там в самом конце.
Вот тут интересно получилось: Паша предлагает после валидации не менять фокус на следующий элемент. У него была открыта клавиатуру Брайля, а после ввода и смены фокуса она сама не закрывается и перестает реагировать на ввод, потому что вводить некуда. Можно просто сообщить, что емейл принят и появились еще элементы.
При этом Паша рассказывает, что скрытие элементов как в задании этой плохой паттерн: даже если элементы недоступны, то про них интересно узнать заранее, чтобы понимать весь сценарий страницы. Но это мой косяк, подумаю как сделать другой тест на нотификейшен .layoutChanged
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.
спасибо за обратную связь!
не удалось сегодня быть утром, обязательно посмотрю видео как только станет доступно.
кажется, тут можно оставить скрытие для обычного ui, а вот VoiceOver "открыть" заранее все элементы.
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.
Такое бывает: адаптируя для VoiceOver мы лучше понимаем как человек строит ментальную модель.
После такого инсайта лучше всего пойти к дизайнеру и обсудить, а нужно ли делать так и для зрячих людей. Вполне возможно, что он согласится с проблемой и ему захочется совсем переделать.
| fileprivate func getNounForCount(count: UInt, multiple: String, few: String, single: String) -> String { | ||
|
|
||
| let hundredRemnant = count % 100 | ||
| let tenRemnant = count % 10 | ||
|
|
||
| if hundredRemnant > 10 && hundredRemnant < 21 { | ||
| return multiple | ||
| } | ||
| else if tenRemnant == 1 { | ||
| return single | ||
| } | ||
| else if tenRemnant > 1 && tenRemnant < 5 { | ||
| return few | ||
| } | ||
|
|
||
| return multiple | ||
| } |
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.
Надежней использовать локализацию через .stringsdict
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.
ого) что-то новое)
я уже лет сто использую такой хелпер, а сами слова кладу в strings файлы
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.
Штука в том, что у разных языков разные правила. В английском есть только две формы (rouble, roubles), в русском 3 (1 рубль, 2 рубля, 5 рублей), в других языках может быть и 4-5. .stringsdict дает способ управлять этим всем.
| sloganLabel.accessibilityLabel = "Поделись кусочком счастья" | ||
| sloganLabel.accessibilityValue = "Подари кусочек пиццы своему другу. Напиши адрес и оплати, а мы пришлем ему письмо где получить." |
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.
Если брать текст из лейблов, то не будет дублирования и текст всегда будет одинаковый для зрячих и незрячих
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.
я тоже так подумал сначала. а потом мне VoiceOver прочел как было в лейбле - "счастьяяяяяя".
тут уже подумалось, что тексты для VoiceOver могут отличаться от значений лейблов.
но, видимо, это лишь исключение из правил было
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.
Возможно, «счастьяяяя» это перебор и для обычных людей :-)
|
|
||
| emailTextField.isAccessibilityElement = true | ||
| emailTextField.accessibilityLabel = "Адрес друга" | ||
| emailTextField.accessibilityTraits.insert(.header) |
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.
Скорее всего поле ввода не должно быть хедером. Понимаю, что рядом с ним надпись была хедером, но Паша говорил, что это непривычно.
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.
понятно. не хотело надпись отдельно как заголовок давать ибо она без поля не имеет смысла
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.
Отделять и правда не нужно, Паша сказал, что в этом смысле поле сделано очень круто. Просто .header для него лишний.
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.
Офтоп вопрос: ты впервые адаптируешь приложение или уже был опыт?
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.
для VoiceOver первый раз. для Dynamic Type уже около года адаптируем, правда только новые экраны. поэтому не все еще его поддерживают. Правда и там ничего не делали пока с кнопками и иконками (иконки только убираем иногда ибо на больших размерах текста от них толку ноль часто).
| paymentButton.accessibilityLabel = "Оплатить" | ||
|
|
||
| successTitleLabel.isAccessibilityElement = true | ||
| successTitleLabel.accessibilityLabel = successTitleLabel.text! + " " + successCountLabel.text! |
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.
Лучше через запятую, это даст легкую паузу
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.
понял
|
|
||
| func refreshAccessibilityFrames() { | ||
|
|
||
| sloganLabel.accessibilityFrame = sloganLabel.frame.union(descriptionLabel.frame) |
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.
Если не конвертируешь фрейм в координаты экрана вручную, то лучше использовать accessibilityFrameInContainerSpace. Сейчас оно тоже работает, потому что в скролвью не завернуто и координаты совпадают.
Вижу, что в других местах конвертируешь.
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.
я его искал, но он только у UIAccessibilityElement есть, а вот у вьют нету(
да, здесь тоже стоило на всякий в экранные координаты переводить
| } | ||
|
|
||
| if let postcardFrame = screenFrame(for: postcardContainer), | ||
| let switchCenter = screenCenter(for: addPostcardSwitch) { |
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.
Оу, а я даже не обращал внимание, что это в координатах экрана надо. Спасибо!
| if paymentButton.isEnabled { | ||
| paymentButton.accessibilityHint = "Можно выполнить из любого места через Magic Tap. Коснитесь двумя пальцами дважды." | ||
| } | ||
| else if emailMistakeLabel.isHidden { | ||
| paymentButton.accessibilityHint = "Введите адрес друга" | ||
| } | ||
| else { | ||
| paymentButton.accessibilityHint = emailMistakeLabel.text | ||
| } |
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.
Очень хорошо
| successTitleLabel.accessibilityFrame = UIAccessibility.convertToScreenCoordinates(successFrame, in: successModalView) | ||
| } | ||
|
|
||
| func refreshAccessibilityProperties() { |
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.
Я бы только постарался разбивать на маленькие функции и применять их рядом с основным кодом, так будет чуть проще поддерживать.
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.
у меня что-то такое, но в зачатке. разделил на то, что устанавливается один раз, то, что меняется, и фреймы.
дальше, как говорится, можно больше) но тут слишком простое приложение
| refreshAccessibilityProperties() | ||
|
|
||
| let argument = email.isValid ? countStepper : emailTextField | ||
| UIAccessibility.post(notification: .layoutChanged, argument: argument) |
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.
Паша смотрел сегодня приложение, разобрал весь кейс, можно будет посмотреть в записи, иос там в самом конце.
Вот тут интересно получилось: Паша предлагает после валидации не менять фокус на следующий элемент. У него была открыта клавиатуру Брайля, а после ввода и смены фокуса она сама не закрывается и перестает реагировать на ввод, потому что вводить некуда. Можно просто сообщить, что емейл принят и появились еще элементы.
При этом Паша рассказывает, что скрытие элементов как в задании этой плохой паттерн: даже если элементы недоступны, то про них интересно узнать заранее, чтобы понимать весь сценарий страницы. Но это мой косяк, подумаю как сделать другой тест на нотификейшен .layoutChanged
| } | ||
| else { | ||
| let emailText = emailTextField.text ?? "" | ||
| emailTextField.accessibilityValue = emailMistakeLabel.text! + ", " + emailText |
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.
Тоже с разбора домашки: в value текстового поля должен быть только текст. Если туда добавить что-то свое, то текстовое поле ломается и предлагает поменять и текст нашей ошибки в том числе. Предлагаю ошибку дописывать в .accessibilityLabel
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.
но accessibilityLabel вроде не должен меняться или я неправильно понял?
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.
Если фокус не меняется, то лейбл и правда не читается, а меняется value после действия, при изменении значения: у степперов и слайдеров, полей ввода.
Тут получается, что value уже занят текстом внутри, поэтому придется писать как-то иначе. Остается только лейбл. При этом, если мы снова поставим фокус на поле ввода, то лейбл прочитается, а если мы завершили редактирование, то лучше сообщить о неправильной валидации через оповещение.
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.
спасибо, понял
все таки без "прослушивания" всех веток сценария самому качественный experience не сделать :)
No description provided.