Backport #39612 * Fix #39610 * Regression of #39262 Also, the old code is very fragile: `#branch_target` is from translation string, so refactored it together Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>