Skip to content

Commit

Permalink
Make ScrollView and ActivityIndicator not focusable by default (#11675)…
Browse files Browse the repository at this point in the history
… (#11863)

* Make ScrollView and ActivityIndicator not focusable by default

* Change files

Co-authored-by: Jon Thysell <jthysell@microsoft.com>
Co-authored-by: Chiara Mooney <34109996+chiaramooney@users.noreply.github.com>
Co-authored-by: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
  • Loading branch information
4 people committed Aug 7, 2023
1 parent 31f5192 commit 6c35c44
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Make ScrollView and ActivityIndicator not focusable by default",
"packageName": "react-native-windows",
"email": "lyahdav@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ void ActivityIndicatorViewManager::GetNativeProps(const winrt::Microsoft::ReactN
winrt::Microsoft::ReactNative::WriteProperty(writer, L"color", L"Color");
}

ShadowNode *Microsoft::ReactNative::ActivityIndicatorViewManager::createShadow() const {
ShadowNode *shadowNode = Super::createShadow();
ShadowNodeBase *shadowNodeBase = static_cast<ShadowNodeBase *>(shadowNode);
shadowNodeBase->IsFocusable(false);
return shadowNode;
}

XamlView ActivityIndicatorViewManager::CreateViewCore(
int64_t /*tag*/,
const winrt::Microsoft::ReactNative::JSValueObject &) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ActivityIndicatorViewManager : public ControlViewManager {

const wchar_t *GetName() const override;
void GetNativeProps(const winrt::Microsoft::ReactNative::IJSValueWriter &writer) const override;
ShadowNode *createShadow() const override;

protected:
bool UpdateProperty(
Expand Down
2 changes: 2 additions & 0 deletions vnext/Microsoft.ReactNative/Views/ScrollViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ void ScrollViewShadowNode::dispatchCommand(
void ScrollViewShadowNode::createView(const winrt::Microsoft::ReactNative::JSValueObject &props) {
Super::createView(props);

IsFocusable(false);

const auto scrollViewer = GetView().as<winrt::ScrollViewer>();
const auto scrollViewUWPImplementation = ScrollViewUWPImplementation(scrollViewer);
scrollViewUWPImplementation.ScrollViewerSnapPointManager();
Expand Down

0 comments on commit 6c35c44

Please sign in to comment.