From 4774689b3e90054324a9f7f61c416ec2a2812ee2 Mon Sep 17 00:00:00 2001 From: chenhaoyue Date: Thu, 6 Feb 2025 15:48:31 +0800 Subject: [PATCH] Fixed: Issue with focusing on text component in button component in accessibility mode. Signed-off-by: chenhaoyue --- .../Libraries/Components/Button/Button.harmony.js | 2 +- react-native-harmony/package.json | 2 +- .../ComponentInstances/TextComponentInstance.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/react-native-harmony/Libraries/Components/Button/Button.harmony.js b/react-native-harmony/Libraries/Components/Button/Button.harmony.js index 2e990a9c..497ac60a 100644 --- a/react-native-harmony/Libraries/Components/Button/Button.harmony.js +++ b/react-native-harmony/Libraries/Components/Button/Button.harmony.js @@ -381,7 +381,7 @@ class Button extends React.Component { onPress={onPress} touchSoundDisabled={touchSoundDisabled}> - + {formattedTitle} diff --git a/react-native-harmony/package.json b/react-native-harmony/package.json index 10100970..a558c141 100644 --- a/react-native-harmony/package.json +++ b/react-native-harmony/package.json @@ -1,6 +1,6 @@ { "name": "@rnoh/react-native-harmony", - "version": "0.72.54", + "version": "0.72.55", "description": "", "scripts": { "install:local-cli": "cd ../react-native-harmony-cli && npm pack && cd ../react-native-harmony && npm i ../react-native-harmony-cli/rnoh-react-native-harmony-cli-0.0.25.tgz && cd ../react-native-harmony", diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp index 54acb045..27d1c9a6 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOHCorePackage/ComponentInstances/TextComponentInstance.cpp @@ -87,7 +87,7 @@ void TextComponentInstance::onPropsChanged( m_textNode.setTextCopyOption(testCopyOption); // Because the default text text in harmony is not focused without barrier, the default value is yes. - if (static_cast(textProps->importantForAccessibility) == 0) { + if (static_cast(textProps->importantForAccessibility) == 0 && textProps->nativeId != "inButton") { facebook::react::ImportantForAccessibility accessibilityValue = facebook::react::ImportantForAccessibility::Yes; this->getLocalRootArkUINode().setAccessibilityLevel(accessibilityValue); } -- Gitee