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

Fixes #4586: Improve text scaling according to screen reader #4695

Merged
merged 28 commits into from
Nov 9, 2022

Conversation

vrajdesai78
Copy link
Contributor

@vrajdesai78 vrajdesai78 commented Nov 4, 2022

Explanation

Fixes #4586: Changed layout_width to sp instead of dp as per this comment. This actually solves the problem of text scaling. Improved text scaling by setting layout_height and layout_width to wrap_content and setting min_height = 48dp and min_width = 48dp (may vary in some cases). Introduced a tests which will make sure that width is set in SP not in DP.

Note: In accessibility scanner it still shows to improve text scaling but visually or practically this solution looks accurate.

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

Screenshots For Mobile (Promoted Story Card)

Default Fonts Large Fonts
Screenshot from 2022-11-05 01-27-47 Screenshot from 2022-11-05 01-28-36
Screenshot from 2022-11-05 01-30-00 Screenshot from 2022-11-05 01-29-23

Screenshots for Tablet (Promoted Story Card)

Default Fonts Large Fonts
Screenshot from 2022-11-05 01-31-14 Screenshot from 2022-11-05 01-31-36
Screenshot from 2022-11-05 01-24-34 Screenshot from 2022-11-05 01-25-16

Failing robolectric tests when we change the width in dp.
Screenshot from 2022-11-07 14-39-57

@BenHenning
Copy link
Member

Thanks @vrajdesai78. I think this seems sensible, but I have two questions:

  1. Doesn't the rest of Fixes #4586: Improve text scaling according to accessibility scanner  #4587 need to be rolled forward/re-added in order to fully fix Improve text scaling according to accessibility scanner  #4586?
  2. How do we ensure that this doesn't break again in the future? It'd be ideal to add some tests to ensure it doesn't break.

@BenHenning BenHenning assigned vrajdesai78 and unassigned BenHenning Nov 5, 2022
@vrajdesai78
Copy link
Contributor Author

Thanks @vrajdesai78. I think this seems sensible, but I have two questions:

  1. Doesn't the rest of Fixes #4586: Improve text scaling according to accessibility scanner  #4587 need to be rolled forward/re-added in order to fully fix Improve text scaling according to accessibility scanner  #4586?
  2. How do we ensure that this doesn't break again in the future? It'd be ideal to add some tests to ensure it doesn't break.

I have added all changes from previous PR. For test I have added one test but not sure it was not failing when we have width set in dp.

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

app/src/main/res/layout/promoted_story_card.xml Outdated Show resolved Hide resolved
app/src/main/res/layout/promoted_story_card.xml Outdated Show resolved Hide resolved
app/src/main/res/layout/promoted_story_card.xml Outdated Show resolved Hide resolved
app/src/main/res/layout/recently_played_fragment.xml Outdated Show resolved Hide resolved
app/src/main/res/values/dimens.xml Show resolved Hide resolved
@rt4914 rt4914 removed their assignment Nov 5, 2022
Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @vrajdesai78. Took a full pass. Many of the comments are duplicates, but I wanted to make sure each case I found for repeated issues were covered by comments.

From a top-level perspective:

  • I think the PR title needs to be updated since this PR is now covering more than just the promoted story list fixes
  • In the original PR there were changes made to app/src/main/res/layout/recently_played_fragment.xml -- why were these dropped here?
  • Are there any other files that require similar changes (e.g. for toolbars & nav menus)?
  • How will developers make sure that they know how to address these sp vs. dp cases long-term? Having a test or check seems important here since it's clear that simply reusing an existing pattern may have different results depending on the view being modified.

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @vrajdesai78. Took another pass--PTAL.

@BenHenning BenHenning removed their assignment Nov 7, 2022
@vrajdesai78
Copy link
Contributor Author

@BenHenning I have updated test and also added screenshot of failing test case in the PR description. Can you PTAL. Thanks

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

@vrajdesai78 I have one suggested.

Also approving this PR not to block you and also relying for test on @BenHenning 's suggestions.

app/src/main/res/values/dimens.xml Show resolved Hide resolved
app/src/main/res/values/dimens.xml Show resolved Hide resolved
@oppiabot oppiabot bot unassigned rt4914 Nov 7, 2022
@oppiabot
Copy link

oppiabot bot commented Nov 7, 2022

Unassigning @rt4914 since they have already approved the PR.

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

Blocking this because of this comment thread #4695 (comment) @BenHenning

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @vrajdesai78. Just to clarify one part of your PR description: should "Failing robolectric tests when we change the width in sp." be "Failing robolectric tests when we change the width to dp" (notice the emphasis)? The current wording doesn't seem correct since the entire intent is to be using sp here.

@BenHenning BenHenning removed their assignment Nov 8, 2022
@vrajdesai78
Copy link
Contributor Author

@BenHenning, I have replied to all of your comments, can you PTAL. Thanks

@rt4914
Copy link
Contributor

rt4914 commented Nov 8, 2022

My latest comment @vrajdesai78 @BenHenning #4695 (comment)

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @vrajdesai78. PR LGTM, so I'm deferring to @rt4914 to resolve my last convo thread (but I'm happy to take another look if needed). I also took a pass on the doc--please let me know when it's ready for another pass.

app/src/main/res/values/dimens.xml Show resolved Hide resolved
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

Approving this PR.

Replying to @BenHenning comment

  1. The implementation of promoted stories recyclerview will change as mentioned in [A11Y] Improve text scaling in promoted story card #4703 . This change is needed to mainly fix one primary issue, i.e., currently we have a fixed-width of 280 for promoted-story-cards but it should be either match_parent so as to provide better experience to non-sighted users. Other details related to implementation are mentioned in the issue description
  2. No TODO has been mentioned in the code as this is neither related to xml files directly nor to bindable adapter, mostly we will need to create a new adapter to implement this functionality. Currently not sure if we can tie this to one single file, therefore not mentioned in code.
  3. I will apply those wiki changes as mentioned in Fixes #4586: Improve text scaling according to screen reader #4695 (comment)

@oppiabot oppiabot bot unassigned rt4914 Nov 9, 2022
@oppiabot
Copy link

oppiabot bot commented Nov 9, 2022

Unassigning @rt4914 since they have already approved the PR.

@oppiabot oppiabot bot added the PR: LGTM label Nov 9, 2022
@rt4914 rt4914 merged commit 69c9a2b into oppia:develop Nov 9, 2022
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.

Improve text scaling according to accessibility scanner
3 participants