Skip to content

fix(accounts): fix IME input and highlight color in password field#3302

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0617-fix-366507
Jun 17, 2026
Merged

fix(accounts): fix IME input and highlight color in password field#3302
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0617-fix-366507

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
  1. Fix normalHighlight initialization timing to avoid wrong color flash
  2. Conditionally apply password input method hints based on echo state
  3. Allow IME input (e.g. Chinese) when password is shown as plain text

Log: Fix Chinese IME input not working in password field when PIN is visible

fix(accounts): 修复密码框输入法和高亮颜色问题

  1. 修复 normalHighlight 初始化时机,避免颜色闪烁
  2. 根据密码可见状态条件应用输入法提示
  3. 明文显示时允许输入法(如中文)正常输入

Log: 修复密码明文显示时无法使用中文输入法的问题
PMS: BUG-366507

Summary by Sourcery

Fix password field behavior for highlight color and input method handling when toggling visibility.

Bug Fixes:

  • Prevent incorrect highlight color flash in the password field by initializing the normal highlight color immediately.
  • Allow IME text input (e.g. Chinese) when the password is shown as plain text instead of being treated as hidden text.
  • Apply password input method hints only when the password is masked, avoiding unnecessary restrictions when it is visible.

@deepin-ci-robot

Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts password TextInput highlight color initialization and conditionally sets input method hints based on password visibility to fix IME behavior and prevent a wrong-color flash.

Flow diagram for conditional password inputMethodHints and echoMode

flowchart TD
    A[Password TextInput created] --> B[normalHighlight = palette.highlight]
    B --> C{echoButtonVisible?}
    C -->|true| D[echoMode = TextInput.Password]
    C -->|true| E[inputMethodHints = Qt.ImhHiddenText | Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase]
    C -->|false| F[echoMode = TextInput.Normal]
    C -->|false| G[inputMethodHints = Qt.ImhNone]

    H[hasErrorBorder or showAlert] --> I[palette.highlight = #FF5736]
    H --> J[palette.highlight = normalHighlight]
Loading

File-Level Changes

Change Details Files
Initialize the password field's normal highlight color from the palette immediately to avoid a transient wrong highlight color when the component is created.
  • Set normalHighlight default value directly to palette.highlight instead of initializing it later in Component.onCompleted
  • Removed Component.onCompleted handler that previously assigned palette.highlight to normalHighlight after creation
src/plugin-accounts/qml/PasswordLayout.qml
Conditionally configure password input method hints and echo mode so that IME input works when the password is shown in plain text while still hiding predictive text when the password is obscured.
  • Wrapped existing inputMethodHints flags in a conditional using echoButtonVisible, applying them only when the password is obscured
  • Set inputMethodHints to Qt.ImhNone when the password is displayed as normal text, allowing IMEs (e.g., Chinese) to work properly with visible PIN/password
  • Kept echoMode bound to echoButtonVisible to toggle between TextInput.Password and TextInput.Normal consistently with the new hints behavior
src/plugin-accounts/qml/PasswordLayout.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • By binding normalHighlight directly to palette.highlight instead of caching it on Component.onCompleted, you may lose the ability to restore the original focus color if the palette changes dynamically at runtime; consider keeping a one-time cached value if that behavior is still required.
  • Using echoButtonVisible to switch inputMethodHints may not exactly reflect the actual echo state (password hidden vs. shown); consider basing the hints on echoMode or a dedicated visibility flag to avoid mismatches when the button is visible but the password is currently plain text.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- By binding `normalHighlight` directly to `palette.highlight` instead of caching it on `Component.onCompleted`, you may lose the ability to restore the original focus color if the palette changes dynamically at runtime; consider keeping a one-time cached value if that behavior is still required.
- Using `echoButtonVisible` to switch `inputMethodHints` may not exactly reflect the actual echo state (password hidden vs. shown); consider basing the hints on `echoMode` or a dedicated visibility flag to avoid mismatches when the button is visible but the password is currently plain text.

## Individual Comments

### Comment 1
<location path="src/plugin-accounts/qml/PasswordLayout.qml" line_range="511-512" />
<code_context>
                 // Cache the normal focus color so we can restore it.
-                property color normalHighlight: "transparent"
-                Component.onCompleted: normalHighlight = palette.highlight
+                property color normalHighlight: palette.highlight
                 palette.highlight: (hasErrorBorder || showAlert) ? "#FF5736" : normalHighlight
                 topPadding: 0
                 bottomPadding: 0
</code_context>
<issue_to_address>
**issue (bug_risk):** This change introduces a binding loop between `normalHighlight` and `palette.highlight`.

`normalHighlight` now depends on `palette.highlight`, while `palette.highlight` also depends on `normalHighlight`, creating a circular binding that will trigger QML binding loop warnings and may cause unstable behavior. The earlier `Component.onCompleted` assignment avoided this by copying the initial value once. To fix this, either keep `normalHighlight` as a one-shot cached value (e.g., set once on completion) or refactor so `palette.highlight` no longer references `normalHighlight` (for example, cache the base highlight in a separate non-reactive property).
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/plugin-accounts/qml/PasswordLayout.qml Outdated
Comment thread src/plugin-accounts/qml/PasswordLayout.qml Outdated
1. Use Qt.binding() for palette.highlight to keep color reactive
   when hasErrorBorder or showAlert state changes
2. Conditionally apply inputMethodHints based on echoButtonVisible
   so input method works correctly when password is visible

Log: Fix password input field highlight color binding and input method hints in accounts module

fix(accounts): 修复密码输入框绑定和输入法提示问题

1. 使用 Qt.binding() 绑定 palette.highlight,确保高亮色随
   hasErrorBorder 或 showAlert 状态变化正确更新
2. 根据 echoButtonVisible 动态设置 inputMethodHints,
   使密码可见时输入法能正常工作

Log: 修复账户模块密码输入框高亮色绑定失效及输入法提示异常问题
PMS: BUG-366507
@MyLeeJiEun MyLeeJiEun force-pushed the fork-from-master-0617-fix-366507 branch from 484f4ba to f567b1c Compare June 17, 2026 07:03
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, MyLeeJiEun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mhduiy

mhduiy commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

/forcemerge

@deepin-bot

deepin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit b6fcbcc into linuxdeepin:master Jun 17, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants