diff --git a/frameworks/core/components_ng/pattern/text/text_pattern.cpp b/frameworks/core/components_ng/pattern/text/text_pattern.cpp index 1ee13b83bb69173ce41eb2f690dde721fb8b7c58..577b93656aeab04d933757be3f0e2146dd52bbaf 100644 --- a/frameworks/core/components_ng/pattern/text/text_pattern.cpp +++ b/frameworks/core/components_ng/pattern/text/text_pattern.cpp @@ -5296,6 +5296,7 @@ void TextPattern::SetResponseRegion(const SizeF& frameSize, const SizeF& boundsS Dimension(std::max(frameSize.Height(), boundsSize.Height())))); hotZoneRegions.emplace_back(hotZoneRegion); gestureHub->SetResponseRegion(hotZoneRegions); + host->UpdateAccessibilityNodeRect(); } void TextPattern::CreateModifier() diff --git a/frameworks/core/components_ng/property/accessibility_property.cpp b/frameworks/core/components_ng/property/accessibility_property.cpp index 475c6932e1e2ed417c528e858c716fa920233c86..7eed56244fb031f58ead478668dea5a39cfc2e72 100755 --- a/frameworks/core/components_ng/property/accessibility_property.cpp +++ b/frameworks/core/components_ng/property/accessibility_property.cpp @@ -308,7 +308,7 @@ bool AccessibilityProperty::IsMatchAccessibilityResponseRegion(bool isAccessibil } auto& rect = responseRegionList.back(); if (rect == origRect) { - return false; + return true; } if (!IsAccessibilityCompInResponseRegion(rect, origRect)) { return false; diff --git a/test/unittest/core/property/accessibility_property_test_ng.cpp b/test/unittest/core/property/accessibility_property_test_ng.cpp index d48068bcd2b46d74f2a2a33ec8fc4639572b56f9..8ba95d8ae161075034565a900b1cf6143dcee785 100644 --- a/test/unittest/core/property/accessibility_property_test_ng.cpp +++ b/test/unittest/core/property/accessibility_property_test_ng.cpp @@ -1260,4 +1260,28 @@ HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest041, TestSize.Lev accessibilityProperty.SetAccessibilityTextPreferred(false); EXPECT_FALSE(accessibilityProperty.IsAccessibilityTextPreferred()); } + +/** + * @tc.name: AccessibilityPropertyTest042 + * @tc.desc: IsMatchAccessibilityResponseRegion + * @tc.type: FUNC + */ +HWTEST_F(AccessibilityPropertyTestNg, AccessibilityPropertyTest042, TestSize.Level1) +{ + AccessibilityProperty accessibilityProperty; + auto host = FrameNode::GetOrCreateFrameNode( + V2::BUTTON_ETS_TAG, 1, []() { return AceType::MakeRefPtr(); }); + host->isActive_ = true; + auto paintRect = host->GetTransformRectRelativeToWindow(); + auto responseRegionList = host->GetResponseRegionList(paintRect, 2); + EXPECT_FALSE(responseRegionList.size() != 1); + + auto rect = responseRegionList.back(); + EXPECT_TRUE(rect == paintRect); + + WeakPtr hostBak = host; + accessibilityProperty.SetHost(hostBak); + auto result = accessibilityProperty.IsMatchAccessibilityResponseRegion(false); + EXPECT_EQ(result, true); +} } // namespace OHOS::Ace::NG