-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closes #18816: Disable TabsTray FAB on accessibility enabled #19170
Conversation
Codecov Report
@@ 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 Continue to review full report at Codecov.
|
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.
Looks good! Some minor nits, but nothing blocking.
import org.mozilla.fenix.tabstray.syncedtabs.SyncedTabsInteractor | ||
import org.mozilla.fenix.utils.Settings | ||
|
||
class NewTabButtonBinding( |
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.
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.
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.
Sure, I'll update.
if (!settings.accessibilityServicesEnabled) { | ||
newTabButton.visibility = View.GONE | ||
return | ||
} |
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.
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.
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.
Good idea. Since TabsTrayFragment
will call start every time there's really no reason for both buttons to observe the store changes. Thanks
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.
Agreed. I'll update. Thanks
} | ||
|
||
private fun setFab(selectedPage: Page, syncing: Boolean) { | ||
/* Do not show fab when accessibility service is enabled */ |
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.
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.
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.
Sure, I'll move this comment on both class to the top in KDocs. They will reference each other 👍
if (settings.accessibilityServicesEnabled) { | ||
actionButton.hide() | ||
return | ||
} |
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.
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 |
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.
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 |
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.
Ooh nice!
Fixes #18816
Pull Request checklist
To download an APK when reviewing a PR: