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

[ui5-textarea] clear entered text on Escape key #10643

Open
nnaydenow opened this issue Jan 23, 2025 · 0 comments
Open

[ui5-textarea] clear entered text on Escape key #10643

nnaydenow opened this issue Jan 23, 2025 · 0 comments
Labels
bug This issue is a bug in the code TOPIC RL

Comments

@nnaydenow
Copy link
Contributor

nnaydenow commented Jan 23, 2025

Discussed in #10638

Originally posted by ThiagoSzz January 23, 2025
Im working on a component that uses the TextArea component and I want to prevent it from clearing the value entered when pressing Escape.

Screen.Recording.2025-01-22.at.21.54.11.mov

I've tried adding the preventTextAreaPropagation function below to the onKeyDown event of the component, but with no results:

const preventTextAreaPropagation = (event: React.KeyboardEvent<HTMLElement>) => {
  if (event.key === 'Escape') {
    event.preventDefault();
    event.stopPropagation();
  }
};

<TextArea
  ...
  onKeyDown={preventTextAreaPropagation}
  ...
/>

Is this possible? If so, how can I achieve this?

Thank you.

I saw that pressing Escape key should restore the value as it was when the focus arrived at the component but preventing the event doesn't prevent this behaviour.

@nnaydenow nnaydenow added bug This issue is a bug in the code TOPIC RL labels Jan 23, 2025
@StefanDimitrov04 StefanDimitrov04 self-assigned this Jan 23, 2025
@StefanDimitrov04 StefanDimitrov04 moved this from New Issues to In progress in Maintenance - Topic RL Jan 23, 2025
@hristop hristop removed their assignment Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug in the code TOPIC RL
Projects
Status: In progress
Development

No branches or pull requests

3 participants