Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions change/react-native-windows-2020-02-25-11-32-44-tabindex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "prerelease",
"comment": "Set IsTabStop to false when tabIndex is negative",
"packageName": "react-native-windows",
"email": "[email protected]",
"commit": "27a16dc9783aefa04c5035c4c2a4b39e8d11f6f8",
"dependentChangeType": "patch",
"date": "2020-02-25T19:32:43.976Z"
}
11 changes: 9 additions & 2 deletions vnext/ReactUWP/Views/ControlViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,15 @@ void ControlViewManager::UpdateProperties(ShadowNodeBase *nodeToUpdate, const fo
} else if (propertyName == "tabIndex") {
if (propertyValue.isNumber()) {
auto tabIndex = propertyValue.asDouble();
if (tabIndex == static_cast<int32_t>(tabIndex))
control.TabIndex(static_cast<int32_t>(tabIndex));
if (tabIndex == static_cast<int32_t>(tabIndex)) {
if (tabIndex < 0) {
control.IsTabStop(false);
control.ClearValue(winrt::Control::TabIndexProperty());
} else {
control.IsTabStop(true);
control.TabIndex(static_cast<int32_t>(tabIndex));
}
}
} else if (propertyValue.isNull()) {
control.ClearValue(winrt::Control::TabIndexProperty());
}
Expand Down
13 changes: 10 additions & 3 deletions vnext/ReactUWP/Views/ViewViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,15 @@ class ViewShadowNode : public ShadowNodeBase {
void TabIndex(int32_t tabIndex) {
m_tabIndex = tabIndex;

if (IsControl())
GetControl().TabIndex(m_tabIndex);
if (IsControl()) {
if (tabIndex < 0) {
GetControl().IsTabStop(false);
GetControl().ClearValue(winrt::Control::TabIndexProperty());
} else {
GetControl().IsTabStop(true);
GetControl().TabIndex(tabIndex);
}
}
}

bool OnClick() {
Expand Down Expand Up @@ -206,7 +213,7 @@ class ViewShadowNode : public ShadowNodeBase {

bool m_enableFocusRing = true;
bool m_onClick = false;
int32_t m_tabIndex = std::numeric_limits<std::int32_t>::max();
int32_t m_tabIndex = -1;

winrt::ContentControl::GotFocus_revoker m_contentControlGotFocusRevoker{};
winrt::ContentControl::LostFocus_revoker m_contentControlLostFocusRevoker{};
Expand Down