-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(kinput): prevent focus loss on icon/button click #2453
Conversation
fix(kinput): fix
✅ Deploy Preview for kongponents-sandbox ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kongponents ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -51,6 +51,8 @@ | |||
:aria-label="`${maskValue ? 'Hide' : 'Show'} value`" | |||
class="mask-value-toggle-button" | |||
@click.stop="maskValue = !maskValue" | |||
@mousedown.prevent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the input stay focusd.
@@ -51,6 +51,8 @@ | |||
:aria-label="`${maskValue ? 'Hide' : 'Show'} value`" | |||
class="mask-value-toggle-button" | |||
@click.stop="maskValue = !maskValue" | |||
@mousedown.prevent | |||
@mouseup.prevent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This keeps the cursor position.
cy.get('.k-input .mask-value-toggle-button').click() | ||
cy.get('.k-input input').should('have.attr', 'type', 'text') | ||
cy.get('.k-input .mask-value-toggle-button').click() | ||
cy.get('.k-input input').should('have.attr', 'type', 'password') | ||
|
||
cy.get('.k-input input').should('have.attr', 'type', 'password').should('be.focused') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: in real user interactions, mouseup
moves the input cursor to the start position, but I couldn't reproduce this behavior in test cases, so this part of the test is not included.
Temporarily blocked by an unexpected usage according to the docs. Should fix that first.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
🎉 This PR is included in version 9.11.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Preview package from this PR in consuming applicationIn consuming application project install preview version of kongponents generated by this PR:
|
Summary
Fixed issue where clicking icons/buttons inside an input caused focus loss. This PR ensures the input remains focused.
Before:
After: