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

fix(EmptyState): Missing accessibility ids on the Empty State - SMARTWIFI-3093 #148

Merged
merged 5 commits into from
Dec 3, 2021

Conversation

pbartolome
Copy link
Contributor

Add properties to the EmptyStateConfiguration to allow changing accessibility identifiers of its elements

@@ -17,7 +17,7 @@ import UIKit
/// the spaces between the texts of a letter. When a text is not configured, her vertical spacing is also ignored.
@dynamicMemberLookup
class StackViewContentItem<Element: UIView>: UIStackView {
private var item: Element
var item: Element
Copy link
Contributor Author

@pbartolome pbartolome Dec 2, 2021

Choose a reason for hiding this comment

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

I had to make this internal... dynamicMemberLookup is sometimes a pain, when the object has a property with a name, it won't use the dynamic lookup... for example when creating a view like let label = StackViewContentItem<UILabel>(topSpacing: 0) and accessing label.accessibilityIdentifier, label.isHidden, etc... as the StackView already has those properties you will be accessing those and not the item's property...

@@ -24,7 +24,7 @@ DEVICES_USED_FOR_TESTING = ["iPhone 13"]
platform :ios do

before_all do
xcversion(version: "13")
xcversion(version: "13") if is_ci
Copy link
Contributor Author

@pbartolome pbartolome Dec 2, 2021

Choose a reason for hiding this comment

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

failing to execute locally if you don't have an xcode named "Xcode_13.app", I removed this constraint so it is executed only on CI

@pbartolome pbartolome requested review from a team, jmbrocal, jmpg93 and alexanegon and removed request for a team and jmbrocal December 2, 2021 11:59
@pbartolome pbartolome changed the title SMARTWIFI-3093 Missing accessibility ids on the Empty State fix(EmptyState): Missing accessibility ids on the Empty State - SMARTWIFI-3093 Dec 2, 2021
Comment on lines 44 to 46
let titleAccesibilityIdentifier: String?
let descriptionAccesibilityIdentifier: String?
let assetAccesibilityIdentifier: String?
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I'm not sure about this one:

  • Here we are using the init to provide the identifiers (no other component does that)
  • In HighlightedCard (and others) we are exposing computed properties to get and set the identifiers.
  • In the Callout we are exposing the inner components.

I would go with the same approach as HighlightedCard so at least almost every component behaves in the same way.

WDYT?

Copy link
Contributor Author

@pbartolome pbartolome Dec 2, 2021

Choose a reason for hiding this comment

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

ok, I thought about that it was a pain to then propagate those attributes to each subelement, I will change it and see how it looks... and what about the EmptyStateButton? there I'm using the init as well

@@ -11,24 +11,30 @@ import Foundation
public struct EmptyStateButton {
public let title: String
public let loadingTitle: String?
public let accesibilityIdentifier: String?
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm feels weird to have this here.
Would be nice to be able to do the same as the title/description.

vc.emptyState.titleAccessibilityIdentifier = "empty_state_title_id"
vc.emptyState.descriptionAccessibilityIdentifier = "empty_state_card_id"
vc.emptyState.assetAccessibilityIdentifier = "empty_state_card_id"
vc.emptyState.secondaryButtonAccessibilityIdentifier = "empty_state_card_id"
vc.emptyState.primaryButtonAccessibilityIdentifier = "empty_state_card_id"
vc.emptyState.linkAccessibilityIdentifier = "empty_state_card_id"

Any particular reason for not doing it this way too? Maybe the way the actions are configured?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no reason, the same as I did initially, add indentifiers to the init, it seemed easier to then pass that configuration to the actual element, I changed it to follow the same approach as the other elements

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the changes!

jmpg93
jmpg93 previously approved these changes Dec 3, 2021
@pbartolome pbartolome merged commit 72d4f2b into main Dec 3, 2021
@pbartolome pbartolome deleted the empty-state-add-accesibility-id branch December 3, 2021 10:03
tuentisre pushed a commit that referenced this pull request Dec 3, 2021
# [14.1.0](v14.0.0...v14.1.0) (2021-12-03)

### Bug Fixes

* **EmptyState:** Missing accessibility ids on the Empty State - SMARTWIFI-3093 ([#148](#148)) ([72d4f2b](72d4f2b))

### Features

* **Feedback:** IOS-7129 ADD: Error Reference inside feedback component ([#144](#144)) ([6da246c](6da246c))
@tuentisre
Copy link
Collaborator

🎉 This PR is included in version 14.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants