react-native-windows 0.69.17 → 0.69.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,7 +67,7 @@
67
67
 
68
68
  <PropertyGroup Label="NuGet" Condition="'$(MSBuildProjectExtension)' == '.vcxproj'">
69
69
  <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
70
- <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
70
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
71
71
  </PropertyGroup>
72
72
 
73
73
  </Project>
@@ -82,16 +82,14 @@ bool ControlViewManager::UpdateProperty(
82
82
  }
83
83
  } else if (propertyName == "focusable") {
84
84
  if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean) {
85
- IsFocusable(propertyValue.AsBoolean());
86
- control.IsTabStop(propertyValue.AsBoolean());
85
+ nodeToUpdate->IsFocusable(propertyValue.AsBoolean());
87
86
  } else if (propertyValue.IsNull()) {
88
- control.ClearValue(TAB_STOP_PROPERTY());
89
- IsFocusable(false);
87
+ nodeToUpdate->IsFocusable(false);
90
88
  }
91
89
  } else {
92
90
  if (propertyName == "accessible") {
93
91
  if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean) {
94
- IsAccessible(propertyValue.AsBoolean());
92
+ nodeToUpdate->IsAccessible(propertyValue.AsBoolean());
95
93
  }
96
94
  }
97
95
  ret = Super::UpdateProperty(nodeToUpdate, propertyName, propertyValue);
@@ -108,11 +106,13 @@ bool ControlViewManager::UpdateProperty(
108
106
  void ControlViewManager::OnPropertiesUpdated(ShadowNodeBase *node) {
109
107
  auto control(node->GetView().as<xaml::Controls::Control>());
110
108
 
111
- if (IsAccessible() != IsFocusable()) {
112
- control.IsTabStop(false);
113
- xaml::Automation::AutomationProperties::SetAccessibilityView(
114
- control, xaml::Automation::Peers::AccessibilityView::Raw);
115
- }
109
+ // If developer specifies either the accessible and focusable prop to be false
110
+ // remove accessibility and keyboard focus for component.
111
+ const auto isTabStop = (node->IsAccessible() && node->IsFocusable());
112
+ const auto accessibilityView =
113
+ isTabStop ? xaml::Automation::Peers::AccessibilityView::Content : xaml::Automation::Peers::AccessibilityView::Raw;
114
+ control.IsTabStop(isTabStop);
115
+ xaml::Automation::AutomationProperties::SetAccessibilityView(control, accessibilityView);
116
116
  }
117
117
 
118
118
  void ControlViewManager::OnViewCreated(XamlView view) {
@@ -123,17 +123,4 @@ void ControlViewManager::OnViewCreated(XamlView view) {
123
123
  }
124
124
  }
125
125
 
126
- void ControlViewManager::IsAccessible(bool accessible) {
127
- m_isAccessible = accessible;
128
- }
129
- bool ControlViewManager::IsAccessible() {
130
- return m_isAccessible;
131
- }
132
- void ControlViewManager::IsFocusable(bool focusable) {
133
- m_isFocusable = focusable;
134
- }
135
- bool ControlViewManager::IsFocusable() {
136
- return m_isFocusable;
137
- }
138
-
139
126
  } // namespace Microsoft::ReactNative
@@ -26,15 +26,6 @@ class REACTWINDOWS_EXPORT ControlViewManager : public FrameworkElementViewManage
26
26
  void OnViewCreated(XamlView view) override;
27
27
 
28
28
  void OnPropertiesUpdated(ShadowNodeBase *node) override;
29
-
30
- private:
31
- void IsAccessible(bool accessible);
32
- bool IsAccessible();
33
- void IsFocusable(bool focusable);
34
- bool IsFocusable();
35
-
36
- bool m_isAccessible = true;
37
- bool m_isFocusable = true;
38
29
  };
39
30
 
40
31
  } // namespace Microsoft::ReactNative
@@ -166,4 +166,17 @@ void ShadowNodeBase::RedBox(const std::string &message) const noexcept {
166
166
  GetViewManager()->GetReactContext().CallJSFunction("RCTLog", "logToConsole", folly::dynamic::array("error", message));
167
167
  }
168
168
 
169
+ void ShadowNodeBase::IsAccessible(bool accessible) {
170
+ m_isAccessible = accessible;
171
+ }
172
+ bool ShadowNodeBase::IsAccessible() {
173
+ return m_isAccessible;
174
+ }
175
+ void ShadowNodeBase::IsFocusable(bool focusable) {
176
+ m_isFocusable = focusable;
177
+ }
178
+ bool ShadowNodeBase::IsFocusable() {
179
+ return m_isFocusable;
180
+ }
181
+
169
182
  } // namespace Microsoft::ReactNative
@@ -115,10 +115,17 @@ struct REACTWINDOWS_EXPORT ShadowNodeBase : public ShadowNode {
115
115
  return m_onMouseEnterRegistered || m_onMouseLeaveRegistered;
116
116
  }
117
117
 
118
+ void IsAccessible(bool accessible);
119
+ bool IsAccessible();
120
+ void IsFocusable(bool focusable);
121
+ bool IsFocusable();
122
+
118
123
  protected:
119
124
  XamlView m_view;
120
125
  bool m_updating = false;
121
126
  comp::CompositionPropertySet m_transformPS{nullptr};
127
+ bool m_isFocusable = true;
128
+ bool m_isAccessible = true;
122
129
 
123
130
  public:
124
131
  double m_padding[(int)ShadowEdges::CountEdges] = INIT_UNDEFINED_EDGES;
@@ -44,6 +44,8 @@ class ViewShadowNode : public ShadowNodeBase {
44
44
  Super::createView(props);
45
45
 
46
46
  auto panel = GetViewPanel();
47
+ IsAccessible(false);
48
+ IsFocusable(false);
47
49
 
48
50
  DynamicAutomationProperties::SetAccessibilityInvokeEventHandler(panel, [=]() {
49
51
  if (OnClick())
@@ -118,24 +120,6 @@ class ViewShadowNode : public ShadowNodeBase {
118
120
  m_onClick = isSet;
119
121
  }
120
122
 
121
- bool IsFocusable() const {
122
- return m_isFocusable;
123
- }
124
- void IsFocusable(bool isFocusable) {
125
- m_isFocusable = isFocusable;
126
-
127
- if (IsControl())
128
- GetControl().IsTabStop(m_isFocusable);
129
- }
130
-
131
- bool IsAccessible() const {
132
- return m_isAccessible;
133
- }
134
-
135
- void IsAccessible(bool isAccessible) {
136
- m_isAccessible = isAccessible;
137
- }
138
-
139
123
  bool IsHitTestBrushRequired() const {
140
124
  return IsRegisteredForMouseEvents();
141
125
  }
@@ -259,8 +243,6 @@ class ViewShadowNode : public ShadowNodeBase {
259
243
 
260
244
  bool m_enableFocusRing = true;
261
245
  bool m_onClick = false;
262
- bool m_isFocusable = false;
263
- bool m_isAccessible = false;
264
246
  int32_t m_tabIndex = std::numeric_limits<std::int32_t>::max();
265
247
 
266
248
  xaml::Controls::ContentControl::GotFocus_revoker m_contentControlGotFocusRevoker{};
@@ -408,20 +390,16 @@ bool ViewViewManager::UpdateProperty(
408
390
  UpdateCornerRadiusOnElement(nodeToUpdate, pPanel);
409
391
  } else if (TryUpdateMouseEvents(nodeToUpdate, propertyName, propertyValue)) {
410
392
  } else if (propertyName == "onClick") {
411
- pViewShadowNode->OnClick(!propertyValue.IsNull() && propertyValue.AsBoolean());
393
+ pViewShadowNode->OnClick(propertyValue.AsBoolean());
412
394
  } else if (propertyName == "overflow") {
413
395
  if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::String) {
414
396
  bool clipChildren = propertyValue.AsString() == "hidden";
415
397
  pPanel.ClipChildren(clipChildren);
416
398
  }
417
399
  } else if (propertyName == "focusable") {
418
- if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean)
419
- pViewShadowNode->IsFocusable(propertyValue.AsBoolean());
400
+ pViewShadowNode->IsFocusable(propertyValue.AsBoolean());
420
401
  } else if (propertyName == "enableFocusRing") {
421
- if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean)
422
- pViewShadowNode->EnableFocusRing(propertyValue.AsBoolean());
423
- else if (propertyValue.IsNull())
424
- pViewShadowNode->EnableFocusRing(false);
402
+ pViewShadowNode->EnableFocusRing(propertyValue.AsBoolean());
425
403
  } else if (propertyName == "tabIndex") {
426
404
  auto tabIndex = propertyValue.AsInt64();
427
405
  if (tabIndex == static_cast<int32_t>(tabIndex)) {
@@ -431,9 +409,7 @@ bool ViewViewManager::UpdateProperty(
431
409
  }
432
410
  } else {
433
411
  if (propertyName == "accessible") {
434
- if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean) {
435
- pViewShadowNode->IsAccessible(propertyValue.AsBoolean());
436
- }
412
+ pViewShadowNode->IsAccessible(propertyValue.AsBoolean());
437
413
  }
438
414
  ret = Super::UpdateProperty(nodeToUpdate, propertyName, propertyValue);
439
415
  }
@@ -458,7 +434,10 @@ void ViewViewManager::OnPropertiesUpdated(ShadowNodeBase *node) {
458
434
  // keep it around, so not adding that code (yet).
459
435
  }
460
436
 
461
- bool shouldBeControl = viewShadowNode->IsFocusable();
437
+ // If component is focusable, it should be a ViewControl.
438
+ // If component is a View with accessible set to true, the component should be focusable, thus we need a ViewControl.
439
+ bool shouldBeControl =
440
+ (viewShadowNode->IsFocusable() || (viewShadowNode->IsAccessible() && !viewShadowNode->OnClick()));
462
441
  if (auto view = viewShadowNode->GetView().try_as<xaml::UIElement>()) {
463
442
  // If we have DynamicAutomationProperties, we need a ViewControl with a
464
443
  // DynamicAutomationPeer
@@ -468,6 +447,7 @@ void ViewViewManager::OnPropertiesUpdated(ShadowNodeBase *node) {
468
447
  panel.FinalizeProperties();
469
448
 
470
449
  TryUpdateView(viewShadowNode, panel, shouldBeControl);
450
+ SyncFocusableAndAccessible(viewShadowNode, shouldBeControl);
471
451
  }
472
452
 
473
453
  void ViewViewManager::TryUpdateView(
@@ -578,11 +558,23 @@ void ViewViewManager::TryUpdateView(
578
558
 
579
559
  if (useControl)
580
560
  pViewShadowNode->GetControl().Content(visualRoot);
561
+ }
581
562
 
582
- if (useControl && pViewShadowNode->IsAccessible() != pViewShadowNode->IsFocusable()) {
583
- pViewShadowNode->GetControl().IsTabStop(false);
584
- xaml::Automation::AutomationProperties::SetAccessibilityView(
585
- pViewShadowNode->GetControl(), xaml::Automation::Peers::AccessibilityView::Raw);
563
+ void ViewViewManager::SyncFocusableAndAccessible(ViewShadowNode *pViewShadowNode, bool useControl) {
564
+ // If developer specifies either the accessible and focusable prop to be false
565
+ // remove accessibility and keyboard focus for component. Exception is made
566
+ // for case where a View with undefined onPress is specified, where
567
+ // component gains accessibility focus when either the accessible and focusable prop are true.
568
+ if (useControl) {
569
+ const auto isFocusable = pViewShadowNode->IsFocusable();
570
+ const auto isAccessible = pViewShadowNode->IsAccessible();
571
+ const auto isPressable = pViewShadowNode->OnClick();
572
+ const auto isTabStop =
573
+ (isPressable && isFocusable && isAccessible) || (!isPressable && (isFocusable || isAccessible));
574
+ const auto accessibilityView = isTabStop ? xaml::Automation::Peers::AccessibilityView::Content
575
+ : xaml::Automation::Peers::AccessibilityView::Raw;
576
+ pViewShadowNode->GetControl().IsTabStop(isTabStop);
577
+ xaml::Automation::AutomationProperties::SetAccessibilityView(pViewShadowNode->GetControl(), accessibilityView);
586
578
  }
587
579
  }
588
580
 
@@ -41,6 +41,7 @@ class ViewViewManager : public FrameworkElementViewManager {
41
41
 
42
42
  XamlView CreateViewCore(int64_t tag, const winrt::Microsoft::ReactNative::JSValueObject &) override;
43
43
  void TryUpdateView(ViewShadowNode *viewShadowNode, winrt::Microsoft::ReactNative::ViewPanel &pPanel, bool useControl);
44
+ void SyncFocusableAndAccessible(ViewShadowNode *viewShadowNode, bool useControl);
44
45
 
45
46
  xaml::Media::SolidColorBrush EnsureTransparentBrush();
46
47
 
@@ -10,10 +10,10 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.69.17</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.69.18</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>69</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>17</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>18</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
18
  </PropertyGroup>
19
19
  </Project>
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <!--
2
+ <!--
3
3
  Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  Licensed under the MIT License.
5
5
 
@@ -10,7 +10,7 @@
10
10
  <PropertyGroup Label="NuGet">
11
11
  <!-- Should match entry in $(ReactNativeWindowsDir)vnext\Directory.Build.props -->
12
12
  <!--See https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-target-->
13
- <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true'">true</RestoreUseStaticGraphEvaluation>
13
+ <RestoreUseStaticGraphEvaluation Condition="'$(BuildingInsideVisualStudio)' == 'true' AND '$(DisableRestoreUseStaticGraphEvaluation)' != 'true'">true</RestoreUseStaticGraphEvaluation>
14
14
 
15
15
  <!-- Ensure PackageReference compatibility for any consuming projects/apps -->
16
16
  <ResolveNuGetPackages>false</ResolveNuGetPackages>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.69.17",
3
+ "version": "0.69.18",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",