Skip to content

Fix icon placement for two step login scenario where username is hidden#2960

Open
JanSvoboda wants to merge 3 commits intokeepassxreboot:developfrom
JanSvoboda:fix/username-input-hidden
Open

Fix icon placement for two step login scenario where username is hidden#2960
JanSvoboda wants to merge 3 commits intokeepassxreboot:developfrom
JanSvoboda:fix/username-input-hidden

Conversation

@JanSvoboda
Copy link
Copy Markdown

In some two-step login scenarios, where the username is filled during the first step and the password is provided in the next, the icon placement might not work properly if the username input is kept hidden.

This fix checks whether username input is visible, if not then icon is displayed on password input.

Screenshots or videos

screenshot_keepassxc_20260429

Testing strategy

Manually tested on some corporate publicly inaccessible login screen. Currently I do not know of any other site that would have the same behaviour.

Type of change

  • ✅ Bug fix (non-breaking change that fixes an issue)

Copilot AI review requested due to automatic review settings April 29, 2026 08:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes login-form icon placement for two-step login flows where the username field becomes hidden on the password step, ensuring the icon is placed on the visible password input instead.

Changes:

  • Only place the default icon on the username field when it is visible.
  • Fall back to placing the default icon on the password field when the username field is missing, read-only, or hidden (two-step login scenario).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread keepassxc-browser/content/icon-handler.js Outdated
@varjolintu
Copy link
Copy Markdown
Member

This repository does not accept AI contributors, or AI-assisted commits. See https://github.com/keepassxreboot/keepassxc-browser/blob/develop/.github/CONTRIBUTING.md#using-ai.

@JanSvoboda
Copy link
Copy Markdown
Author

Hello,
is it because the copilot did pull request review? Can I disable that somehow? Not really sure here, as I haven't done any pull request in ages. I noticed that PR name was AI generated - honestly didn't notice that when I was doing the PR.

@varjolintu
Copy link
Copy Markdown
Member

For me it showed that Copilot created this pull request. Now it doesn't show that? Strange. The Copilot review stuff is temporary enabled to see if it helps.

@varjolintu varjolintu reopened this Apr 29, 2026
@varjolintu varjolintu added the bug label Apr 29, 2026
@varjolintu varjolintu self-requested a review April 29, 2026 09:56
@JanSvoboda
Copy link
Copy Markdown
Author

ok, thank you, Copilot didn't do that PR, I did, I was afraid that I screwed something up

@JanSvoboda
Copy link
Copy Markdown
Author

might I have a question? copilot suggested logical change, if I were to implement it as suggested, how would it be evaluated? as AI assisted or not?

@varjolintu
Copy link
Copy Markdown
Member

might I have a question? copilot suggested logical change, if I were to implement it as suggested, how would it be evaluated? as AI assisted or not?

It would be AI assisted :) I'd rather just take some hints from its suggestions, but not implement anything directly. I'm also thinking disabling Copilot here. Sometimes its suggestions are pretty random.

}

if (c.username && !c.username.readOnly) {
if (c.username && !c.username.readOnly && kpxcFields.isVisible(c.username)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use:
const usernameFieldVisible = c.username && kpxcFields.isVisible(c.username);

kpxcIcons.addIcon(c.username, kpxcIcons.iconTypes.DEFAULT);
} else if (c.password && (!c.username || (c.username && c.username.readOnly))) {
// Single password field
} else if (c.password && (!c.username || c.username.readOnly || !kpxcFields.isVisible(c.username))) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be:
} else if (c.password && (!c.username || (c.username && (c.username.readOnly || !usernameFieldVisible)))) {

So the single password field applies if:

  • Password field is defined
  • Usename field is not found OR
  • Username field is found, but is readOnly or not visible

@varjolintu
Copy link
Copy Markdown
Member

I would need some actual site where the error happens and I can confirm the fix works.

Copilot AI review requested due to automatic review settings May 4, 2026 09:30
@varjolintu varjolintu review requested due to automatic review settings May 4, 2026 09:31
@JanSvoboda
Copy link
Copy Markdown
Author

I reflected your suggestions. I can provide you with some website, however I would rather avoid posting it here, if possible, is there some way how can I send it to you directly?

@varjolintu
Copy link
Copy Markdown
Member

I reflected your suggestions. I can provide you with some website, however I would rather avoid posting it here, if possible, is there some way how can I send it to you directly?

Private message in Matrix, or via email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants