fix(input): preserva cursor ao aplicar upperCase no eventOnInput#2856
Open
br-robles wants to merge 1 commit into
Open
fix(input): preserva cursor ao aplicar upperCase no eventOnInput#2856br-robles wants to merge 1 commit into
br-robles wants to merge 1 commit into
Conversation
Ao converter o valor para maiúsculas no método eventOnInput, o cursor era reposicionado para o final do campo, prejudicando a experiência do usuário ao editar textos no meio da string. Captura a posição do cursor antes da transformação e restaura via setSelectionRange após aplicar o toUpperCase, garantindo que o cursor permaneça na posição correta. Fixes po-ui#2387
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ao converter o valor para maiúsculas no método eventOnInput, o cursor era reposicionado para o final do campo, prejudicando a experiência do usuário ao editar textos no meio da string.
Captura a posição do cursor antes da transformação e restaura via setSelectionRange após aplicar o toUpperCase, garantindo que o cursor permaneça na posição correta.
Fixes #2387
po-input
#2387
PR Checklist [Revisor]
Qual o comportamento atual?
Ao digitar no meio de uma frase no componente po-input com o cursor ia para o fim da frase.
Qual o novo comportamento?
O cursor se mantém no lugar esperado ao digitar no meio da frase.
Simulação
Para simular necessário rodar o projeto, aplicar no arquivo no app.component o código encontrado no stackblitz fornecido na abertura da issue: https://stackblitz.com/edit/po-ui-beqs56bj?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.ts