-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add changes to disabled property for components (e.g TouchableHighlight) #11278
Conversation
@@ -124,7 +128,7 @@ void ControlViewManager::OnPropertiesUpdated(ShadowNodeBase *node) { | |||
|
|||
// If developer specifies either the accessible and focusable prop to be false | |||
// remove accessibility and keyboard focus for component. | |||
const auto isTabStop = (node->IsAccessible() && node->IsFocusable()); | |||
const auto isTabStop = node->IsDisable() ? false : node->IsAccessible() && node->IsFocusable(); |
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: could use bang operator here
const auto isTabStop = | ||
(isPressable && isFocusable && isAccessible) || (!isPressable && (isFocusable || isAccessible)); | ||
const auto isDisabled = pViewShadowNode->IsDisable(); | ||
const auto isTabStop = (isDisabled ? false : ((isPressable && isFocusable && isAccessible) || (!isPressable && (isFocusable || isAccessible)))); |
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: same here re !
operator
|
||
protected: | ||
XamlView m_view; | ||
bool m_updating = false; | ||
bool m_isFocusable = true; | ||
bool m_isAccessible = true; | ||
bool m_isDisable = false; |
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.
consider naming this m_isDisabled and the above to IsDisabled to align with the disabled
property name.
if (finalizeBorderRadius && control.try_as<xaml::Controls::IControl7>()) { | ||
// Control.CornerRadius is only supported on >= RS5, setting borderRadius on Controls have no effect < RS5 | ||
UpdateCornerRadiusOnElement(nodeToUpdate, control); | ||
// Control.CornerRadius is only supported on >= RS5, setting borderRadius on Controls have no effect < RS5 |
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: white space
It's worth testing that it works for <Pressable onPress={onPressFunction}>
<Text>I'm pressable!</Text>
</Pressable> |
const auto isTabStop = | ||
(isPressable && isFocusable && isAccessible) || (!isPressable && (isFocusable || isAccessible)); | ||
(!isDisabled && |
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 you haven't already, I'd also double check that this issue (#10687) isn't being reintroduced just with the disabled prop causing it now
Description
Added changes to prevent components that are disabled from being keyboard focusable. Used TouchableHighlight issue #8875 as example.
Type of Change
Why
Resolves [#8875 ]
What
Added logic to check
disabled
property on components and, if true, make them not focusable.Screenshots
After:
Breakpoint on
disabled={true}
Testing
Tested on a TouchableHighlight component in playground. When
disabled
prop is set totrue
, Touchable component no longer receives keyboard focus, both in and out of Narrator mode, as shown in 'After' screenshot. Also, breakpoint fordisabled
property check inViewViewManager
is being hit when Touchable component hasdisabled={true}
.Microsoft Reviewers: Open in CodeFlow
Microsoft Reviewers: Open in CodeFlow