From 616ca3056ea5997984395ff802dfa366a79f2e1c Mon Sep 17 00:00:00 2001 From: Keith Melmon Date: Wed, 13 May 2020 12:47:43 -0700 Subject: [PATCH 1/4] Change files --- ...ve-windows-2020-05-13-12-47-43-tabfocus-fix.json | 8 ++++++++ vnext/ReactUWP/Views/ControlViewManager.cpp | 10 ++-------- vnext/ReactUWP/Views/ViewViewManager.cpp | 13 +++---------- 3 files changed, 13 insertions(+), 18 deletions(-) create mode 100644 change/react-native-windows-2020-05-13-12-47-43-tabfocus-fix.json diff --git a/change/react-native-windows-2020-05-13-12-47-43-tabfocus-fix.json b/change/react-native-windows-2020-05-13-12-47-43-tabfocus-fix.json new file mode 100644 index 00000000000..3832af20367 --- /dev/null +++ b/change/react-native-windows-2020-05-13-12-47-43-tabfocus-fix.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "revert dfc57fcf2504f57baab20f550b36a618eaa99e56", + "packageName": "react-native-windows", + "email": "kmelmon@microsoft.com", + "dependentChangeType": "patch", + "date": "2020-05-13T19:47:43.325Z" +} diff --git a/vnext/ReactUWP/Views/ControlViewManager.cpp b/vnext/ReactUWP/Views/ControlViewManager.cpp index 0b26c602d03..589f363007f 100644 --- a/vnext/ReactUWP/Views/ControlViewManager.cpp +++ b/vnext/ReactUWP/Views/ControlViewManager.cpp @@ -58,15 +58,9 @@ bool ControlViewManager::UpdateProperty( } else if (propertyName == "tabIndex") { if (propertyValue.isNumber()) { auto tabIndex = propertyValue.asDouble(); - if (tabIndex == static_cast(tabIndex)) { - if (tabIndex < 0) { - control.IsTabStop(false); - control.ClearValue(xaml::Controls::Control::TabIndexProperty()); - } else { - control.IsTabStop(true); + if (tabIndex == static_cast(tabIndex)) + control.ClearValue(xaml::Controls::Control::TabIndexProperty()); control.TabIndex(static_cast(tabIndex)); - } - } } else if (propertyValue.isNull()) { control.ClearValue(xaml::Controls::Control::TabIndexProperty()); } diff --git a/vnext/ReactUWP/Views/ViewViewManager.cpp b/vnext/ReactUWP/Views/ViewViewManager.cpp index efc490184a1..f2856ca80b0 100644 --- a/vnext/ReactUWP/Views/ViewViewManager.cpp +++ b/vnext/ReactUWP/Views/ViewViewManager.cpp @@ -87,15 +87,8 @@ class ViewShadowNode : public ShadowNodeBase { void TabIndex(int32_t tabIndex) { m_tabIndex = tabIndex; - if (IsControl()) { - if (tabIndex < 0) { - GetControl().IsTabStop(false); - GetControl().ClearValue(xaml::Controls::Control::TabIndexProperty()); - } else { - GetControl().IsTabStop(true); - GetControl().TabIndex(tabIndex); - } - } + if (IsControl()) + GetControl().TabIndex(m_tabIndex); } bool OnClick() { @@ -213,7 +206,7 @@ class ViewShadowNode : public ShadowNodeBase { bool m_enableFocusRing = true; bool m_onClick = false; - int32_t m_tabIndex = -1; + int32_t m_tabIndex = std::numeric_limits::max(); xaml::Controls::ContentControl::GotFocus_revoker m_contentControlGotFocusRevoker{}; xaml::Controls::ContentControl::LostFocus_revoker m_contentControlLostFocusRevoker{}; From 24163eafb91becdf52863ccd9fe6a22368a25506 Mon Sep 17 00:00:00 2001 From: Keith Melmon Date: Wed, 13 May 2020 12:50:36 -0700 Subject: [PATCH 2/4] revert dfc57fcf2504f57baab20f550b36a618eaa99e56 --- vnext/ReactUWP/Views/ControlViewManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vnext/ReactUWP/Views/ControlViewManager.cpp b/vnext/ReactUWP/Views/ControlViewManager.cpp index 589f363007f..e91cb4a0226 100644 --- a/vnext/ReactUWP/Views/ControlViewManager.cpp +++ b/vnext/ReactUWP/Views/ControlViewManager.cpp @@ -58,9 +58,9 @@ bool ControlViewManager::UpdateProperty( } else if (propertyName == "tabIndex") { if (propertyValue.isNumber()) { auto tabIndex = propertyValue.asDouble(); - if (tabIndex == static_cast(tabIndex)) - control.ClearValue(xaml::Controls::Control::TabIndexProperty()); - control.TabIndex(static_cast(tabIndex)); + if (tabIndex == static_cast(tabIndex)) + control.ClearValue(xaml::Controls::Control::TabIndexProperty()); + control.TabIndex(static_cast(tabIndex)); } else if (propertyValue.isNull()) { control.ClearValue(xaml::Controls::Control::TabIndexProperty()); } From 7e7ff9ac768b617b1cebc9b312eeecda87f39053 Mon Sep 17 00:00:00 2001 From: Keith Melmon Date: Wed, 13 May 2020 13:14:41 -0700 Subject: [PATCH 3/4] set default tab index to -1, the hope is to be in line with xbox assumption --- vnext/ReactUWP/Views/ViewViewManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vnext/ReactUWP/Views/ViewViewManager.cpp b/vnext/ReactUWP/Views/ViewViewManager.cpp index f2856ca80b0..44f7d01b858 100644 --- a/vnext/ReactUWP/Views/ViewViewManager.cpp +++ b/vnext/ReactUWP/Views/ViewViewManager.cpp @@ -206,7 +206,7 @@ class ViewShadowNode : public ShadowNodeBase { bool m_enableFocusRing = true; bool m_onClick = false; - int32_t m_tabIndex = std::numeric_limits::max(); + int32_t m_tabIndex = -1; xaml::Controls::ContentControl::GotFocus_revoker m_contentControlGotFocusRevoker{}; xaml::Controls::ContentControl::LostFocus_revoker m_contentControlLostFocusRevoker{}; From f18d7f51add1e6a10ea09f23c7370632cd22e4e7 Mon Sep 17 00:00:00 2001 From: Keith Melmon Date: Wed, 13 May 2020 13:54:47 -0700 Subject: [PATCH 4/4] xbox doesn't seem to rely on this, changing default back to match xaml default --- vnext/ReactUWP/Views/ViewViewManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vnext/ReactUWP/Views/ViewViewManager.cpp b/vnext/ReactUWP/Views/ViewViewManager.cpp index 44f7d01b858..74b4efe12a8 100644 --- a/vnext/ReactUWP/Views/ViewViewManager.cpp +++ b/vnext/ReactUWP/Views/ViewViewManager.cpp @@ -206,7 +206,7 @@ class ViewShadowNode : public ShadowNodeBase { bool m_enableFocusRing = true; bool m_onClick = false; - int32_t m_tabIndex = -1; + int32_t m_tabIndex = std::numeric_limits::max(); xaml::Controls::ContentControl::GotFocus_revoker m_contentControlGotFocusRevoker{}; xaml::Controls::ContentControl::LostFocus_revoker m_contentControlLostFocusRevoker{}; @@ -368,7 +368,7 @@ bool ViewViewManager::UpdateProperty( pViewShadowNode->TabIndex(static_cast(tabIndex)); } } else if (propertyValue.isNull()) { - pViewShadowNode->TabIndex(-1); + pViewShadowNode->TabIndex(std::numeric_limits::max()); } } else { ret = Super::UpdateProperty(nodeToUpdate, propertyName, propertyValue);