Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Closes #18816: Disable TabsTray FAB on accessibility enabled #19170

Merged
merged 1 commit into from
Apr 22, 2021

Conversation

rocketsroger
Copy link
Contributor

@rocketsroger rocketsroger commented Apr 21, 2021

Fixes #18816

Pull Request checklist

  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features. In addition, it includes a screenshot of a successful accessibility scan to ensure no new defects are added to the product.

To download an APK when reviewing a PR:

  1. click on Show All Checks,
  2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
  3. click on the "Fenix - assemble" task, then click "Run Artifacts".
  4. the APK links should be on the left side of the screen, named for each CPU architecture

@rocketsroger rocketsroger added the needs:review PRs that need to be reviewed label Apr 21, 2021
@rocketsroger rocketsroger requested review from a team as code owners April 21, 2021 19:57
@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2021

Codecov Report

Merging #19170 (426a58d) into master (cf4847d) will increase coverage by 0.12%.
The diff coverage is 60.00%.

❗ Current head 426a58d differs from pull request most recent head 43d8d72. Consider uploading reports for the commit 43d8d72 to get more accurate results
Impacted file tree graph

@@             Coverage Diff              @@
##             master   #19170      +/-   ##
============================================
+ Coverage     34.65%   34.78%   +0.12%     
- Complexity     1639     1643       +4     
============================================
  Files           541      542       +1     
  Lines         21946    21971      +25     
  Branches       3283     3285       +2     
============================================
+ Hits           7606     7642      +36     
+ Misses        13441    13426      -15     
- Partials        899      903       +4     
Impacted Files Coverage Δ Complexity Δ
...ava/org/mozilla/fenix/tabstray/TabsTrayFragment.kt 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../org/mozilla/fenix/tabstray/NewTabButtonBinding.kt 71.87% <71.87%> (ø) 7.00 <7.00> (?)
...illa/fenix/tabstray/FloatingActionButtonBinding.kt 76.31% <90.90%> (+76.31%) 7.00 <5.00> (+7.00)
...settings/creditcards/CreditCardsSettingFragment.kt 0.00% <0.00%> (-23.34%) 0.00% <0.00%> (-7.00%)
...main/java/org/mozilla/fenix/components/UseCases.kt 75.00% <0.00%> (-3.95%) 1.00% <0.00%> (ø%)
...rg/mozilla/fenix/settings/account/AccountUiView.kt 34.14% <0.00%> (-2.44%) 4.00% <0.00%> (ø%)
...src/main/java/org/mozilla/fenix/components/Core.kt 20.00% <0.00%> (-0.61%) 2.00% <0.00%> (-2.00%)
...pp/src/main/java/org/mozilla/fenix/HomeActivity.kt 24.31% <0.00%> (ø) 28.00% <0.00%> (ø%)
...in/java/org/mozilla/fenix/perf/NavGraphProvider.kt 62.50% <0.00%> (ø) 2.00% <0.00%> (-1.00%)
.../mozilla/fenix/search/awesomebar/AwesomeBarView.kt 0.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b3e4c0...43d8d72. Read the comment docs.

Copy link
Contributor

@jonalmeida jonalmeida left a comment

Choose a reason for hiding this comment

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

Looks good! Some minor nits, but nothing blocking.

import org.mozilla.fenix.tabstray.syncedtabs.SyncedTabsInteractor
import org.mozilla.fenix.utils.Settings

class NewTabButtonBinding(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Since we're making this solely for accessibility, maybe we can name it as such?

Maybe, AccessibleNewTabButtonBinding? That might catch the right-person's eye if they're confused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll update.

Comment on lines 54 to 57
if (!settings.accessibilityServicesEnabled) {
newTabButton.visibility = View.GONE
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we lift this up to the caller (start) and put it above the store.flowScoped line? I think that makes it clearer that this will only be performed on start vs. a "setFab" that doesn't always set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea. Since TabsTrayFragment will call start every time there's really no reason for both buttons to observe the store changes. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I'll update. Thanks

}

private fun setFab(selectedPage: Page, syncing: Boolean) {
/* Do not show fab when accessibility service is enabled */
Copy link
Contributor

Choose a reason for hiding this comment

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

This binding is coupled with the FloatingActionButtonBinding, so let's reference in this comment here, or better as a kdoc for the class, to take a look at the other one?

Related: I've been using the symbol matching in KDocs to ensure that related classes can be found through Android Studio and other symbolic referencing tools, like rename, safe-delete, etc.

You can reference the class in the KDocs with [FloatingActionButtonBinding] and you should be able to control-click on it to go to that class from the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll move this comment on both class to the top in KDocs. They will reference each other 👍

Comment on lines 53 to 56
if (settings.accessibilityServicesEnabled) {
actionButton.hide()
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

See below comment about lifting this up to the calling method.

@@ -0,0 +1,170 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for going out of the way to write tests for this! ✨ ✨ ✨

@@ -312,7 +327,7 @@ class TabsTrayFragment : AppCompatDialogFragment(), TabsTrayInteractor {
},
operation = { },
elevation = ELEVATION,
anchorView = new_tab_button
anchorView = if (new_tab_button.isVisible) new_tab_button else null
Copy link
Contributor

Choose a reason for hiding this comment

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

Ooh nice!

@rocketsroger rocketsroger reopened this Apr 22, 2021
@rocketsroger rocketsroger merged commit cd37f39 into mozilla-mobile:master Apr 22, 2021
@rocketsroger rocketsroger deleted the FB_18816 branch April 22, 2021 16:48
@rocketsroger rocketsroger removed the needs:review PRs that need to be reviewed label Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable TabsTray FAB on accessibility enabled
3 participants