Open
fix(View): register click before focus so a View can take keyboard focus #3884
fix(View): register click before focus so a View can take keyboard focus #3884
Open
changlpAdd on 22 hours ago
changlpCollaborators
22 hours ago

Change Type

Please check √ next to the corresponding type, only one option can be selected:

Change Description

With ALL_CONTAINERS_CLICKABLE OFF, ArkUI lets a container take keyboard focus by itself only when NODE_ON_CLICK is registered before NODE_FOCUSABLE is written. View::onPropsChanged used to write NODE_FOCUSABLE for accessible before registering the click for focusable, so a View with both accessible={true} and focusable={true} could not take keyboard focus.

CustomNode::setClickRegistered registers or unregisters NODE_ON_CLICK and does not write NODE_FOCUSABLE. In OFF mode, the click registration follows the focusable prop only. NODE_FOCUSABLE is then set to accessible || focusable.

  • accessible={true} alone writes NODE_FOCUSABLE and does not register a click. The View cannot take keyboard focus, and a screen-reader double tap stays a touch.
  • accessible={true} with focusable={true} registers the click first, then writes NODE_FOCUSABLE. The View can take keyboard focus, and a screen-reader double tap is a click.
  • focusable={true} registers the click and writes NODE_FOCUSABLE. The View can take keyboard focus, and a screen-reader double tap is a click.
  • A View that needs keyboard focus while keeping the screen-reader double tap as a touch should leave focusable unset and mount its own focusable child.

ON mode is unchanged: the constructor still registers NODE_ON_CLICK, and setFocusable only writes NODE_FOCUSABLE.

This adds the internal C++ method CustomNode::setClickRegistered. No JS prop is added or removed. The behavior applies to RN View keyboard focus and screen-reader double tap when ALL_CONTAINERS_CLICKABLE is OFF. The same rules are documented in the Chinese and English usage FAQs.

Test Steps

Test reference: gtest: rnoh_customnode_focusable_test, rnoh_customnode_focusable_on_test, rnoh_view_ci_props_test, rnoh_view_ci_props_on_test

Host gtest files for this behavior are not on this version line. The same cases cover it on 0.84 and 0.86.

  1. With ALL_CONTAINERS_CLICKABLE OFF, reach a focusable={true} View from the keyboard.
  2. Confirm accessible={true} without focusable does not register NODE_ON_CLICK.
  3. Confirm accessible={true} and focusable={true} registers click, then sets focusable.
  4. Confirm ON mode behavior is not affected.

Test Status

Pre-merge Self-Check

Linked Issue

Close #3539

likedislike
Merge blocked
CchanglpCollaborators
22 hours ago Added label: bug
cpf-managercpf-managerCollaborators
22 hours ago Added label: AI检视中
CchanglpCollaborators
22 hours ago Associated issue: View cannot gain keyboard focus with ALL_CONTAINERS_CLICKABLE OFF
openharmony_ci
openharmony_ciCollaborators
22 hours ago Comments:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
openharmony_ciopenharmony_ciCollaborators
22 hours ago Added label: dco检查成功
CchanglpCollaborators
22 hours ago Pushed 1 commits:ec4e0786-fix(View): drop unrelated formatting from the focus fix
cpf-managercpf-managerCollaborators
22 hours ago Removed label: AI检视中
cpf-managercpf-managerCollaborators
22 hours ago Added label: AI未检视
cpf-managercpf-managerCollaborators
22 hours ago Removed label: AI未检视
cpf-managercpf-managerCollaborators
22 hours ago Added label: AI检视中
openharmony_ci
openharmony_ciCollaborators
22 hours ago Comments:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
cpf-managercpf-managerCollaborators
22 hours ago Removed label: AI检视中
cpf-managercpf-managerCollaborators
22 hours ago Added label: AI已检视
CchanglpCollaborators
22 hours ago Force-pushed 1 commits:c9d9b35e-fix(View): register click before focus so a View can take keyboard focus
cpf-managercpf-managerCollaborators
22 hours ago Removed label: AI已检视
cpf-managercpf-managerCollaborators
22 hours ago Added label: AI检视中
openharmony_ci
openharmony_ciCollaborators
22 hours ago Comments:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
cpf-managercpf-managerCollaborators
22 hours ago Removed label: AI检视中
cpf-managercpf-managerCollaborators
22 hours ago Added label: AI已检视
CchanglpCollaborators
20 hours ago Force-pushed 1 commits:5ef50640-fix(View): register click before focus so a View can take keyboard focus
cpf-managercpf-managerCollaborators
20 hours ago Removed label: AI已检视
cpf-managercpf-managerCollaborators
20 hours ago Added label: AI检视中
openharmony_ci
openharmony_ciCollaborators
20 hours ago Comments:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
cpf-managercpf-managerCollaborators
20 hours ago Removed label: AI检视中
cpf-managercpf-managerCollaborators
20 hours ago Added label: AI已检视
CchanglpCollaborators
5 hours ago Modify description of pull request
CchanglpCollaborators
2 hours ago Modify description of pull request
CchanglpCollaborators
2 hours ago Associated issue: [Bug] [severity: normal] [category: feature] [version: 0.77] [component: component] View with accessible and focusable cannot take keyboard focus when ALL_CONTAINERS_CLICKABLE is OFF
CchanglpCollaborators
2 hours ago Modify description of pull request
changlpCollaborators
2 hours ago Comments:

start build

likedislike
openharmony_ci
openharmony_ciCollaborators
2 hours ago Comments:

首次触发
门禁构建开始,包含静态检查、代码编译【rnoh_0.77-main编译】,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6aeec32664650f998bf6eb82/runlist

likedislike
openharmony_ciopenharmony_ciCollaborators
2 hours ago Added label: 静态检查失败
openharmony_ci
openharmony_ciCollaborators
2 hours ago Comments:

代码门禁未通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6aeec32664650f998bf6eb82/runlist

静态检查:

# check type result report
1 codeCheck noPass >>>

编译测试:
# Device build result package
1 rnoh_0.77-main pending NA

likedislike