Skip to content
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

[TextboxMultiline] unable to remove selection on focus #184

Open
Profesor08 opened this issue Sep 1, 2023 · 0 comments · May be fixed by #185
Open

[TextboxMultiline] unable to remove selection on focus #184

Profesor08 opened this issue Sep 1, 2023 · 0 comments · May be fixed by #185
Labels
enhancement New feature or request

Comments

@Profesor08
Copy link

This code brings weird behavior to textarea, when I want to write something, it selects all content. And there is no way to remove this.

const handleFocus = useCallback(
function (event: JSX.TargetedFocusEvent<HTMLTextAreaElement>): void {
setOriginalValue(value)
event.currentTarget.select()
},
[value]
)

There are two options to solve this. First is to add an config, to disable this. Second is to to move ...rest to end, to allow to override props.

<textarea
{...rest}
ref={textAreaElementRef}
class={styles.textarea}
disabled={disabled === true}
name={name}
onBlur={handleBlur}
onFocus={handleFocus}
onInput={handleInput}
onKeyDown={handleKeyDown}
onMouseUp={handleMouseUp}
placeholder={placeholder}
rows={rows}
spellcheck={spellCheck}
tabIndex={disabled === true ? -1 : 0}
value={value === MIXED_STRING ? 'Mixed' : value}
/>

@yuanqing yuanqing added the enhancement New feature or request label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants