@@ -175,29 +175,22 @@ class ViewShadowNode : public ShadowNodeBase {
175175 winrt::make<winrt::react::uwp::implementation::ViewControl>();
176176
177177 m_contentControlGotFocusRevoker =
178- contentControl.GotFocus (winrt::auto_revoke, [=](auto &&, auto &&) {
179- DispatchEvent (
180- " topFocus" , std::move (folly::dynamic::object (" target" , m_tag)));
178+ contentControl.GotFocus (winrt::auto_revoke, [=](auto &&, auto &&args) {
179+ if (args.OriginalSource ().try_as <winrt::UIElement>() ==
180+ contentControl.as <winrt::UIElement>()) {
181+ auto tag = m_tag;
182+ DispatchEvent (
183+ " topFocus" , std::move (folly::dynamic::object (" target" , tag)));
184+ }
181185 });
182186
183187 m_contentControlLostFocusRevoker =
184- contentControl.LostFocus (winrt::auto_revoke, [=](auto &&, auto &&) {
185- DispatchEvent (
186- " topBlur" , std::move (folly::dynamic::object (" target" , m_tag)));
187- });
188-
189- // FUTURE: The space/enter handler can be removed in August 2019, still here
190- // to enable transitioning to new events if native code is updated before JS
191- m_contentControlKeyDownRevoker = contentControl.KeyDown (
192- winrt::auto_revoke, [=](auto &&, winrt::KeyRoutedEventArgs const &e) {
193- if (e.Key () == winrt::VirtualKey::Enter ||
194- e.Key () == winrt::VirtualKey::Space) {
195- if (OnClick ()) {
196- DispatchEvent (
197- " topClick" ,
198- std::move (folly::dynamic::object (" target" , m_tag)));
199- e.Handled (true );
200- }
188+ contentControl.LostFocus (winrt::auto_revoke, [=](auto &&, auto &&args) {
189+ if (args.OriginalSource ().try_as <winrt::UIElement>() ==
190+ contentControl.as <winrt::UIElement>()) {
191+ auto tag = m_tag;
192+ DispatchEvent (
193+ " topBlur" , std::move (folly::dynamic::object (" target" , tag)));
201194 }
202195 });
203196
@@ -220,7 +213,6 @@ class ViewShadowNode : public ShadowNodeBase {
220213
221214 winrt::ContentControl::GotFocus_revoker m_contentControlGotFocusRevoker{};
222215 winrt::ContentControl::LostFocus_revoker m_contentControlLostFocusRevoker{};
223- winrt::ContentControl::KeyDown_revoker m_contentControlKeyDownRevoker{};
224216};
225217
226218// ViewPanel uses a ViewBackground property, not Background, so need to
0 commit comments