Skip to content

Conversation

Sumon249
Copy link

The page should not reload when the 'enter' key is pressed.

Fixes #12167

The page should not reload when the 'enter' key is pressed.

Fixes UI5#12167
Copy link

cla-assistant bot commented Aug 25, 2025

CLA assistant check
All committers have signed the CLA.

@nnaydenow nnaydenow requested review from MapTo0, ivoplashkov and a team August 26, 2025 07:42
@nnaydenow
Copy link
Contributor

Hello @Sumon249,

Thank you for the contribution!


Hello @SAP/ui5-webcomponents-topic-rl,

Could you please take a look at that PR?

Regards,
Nayden

@ilhan007 ilhan007 changed the title fix(ui-multiInput): prevent page reload on enter fix(ui5-multiInput): prevent page reload on enter Aug 28, 2025
@ndeshev ndeshev self-requested a review September 2, 2025 09:47
@ndeshev
Copy link
Contributor

ndeshev commented Sep 2, 2025

Hello @Sumon249, could you please add Cypress test to cover this fix? Having tests in place will help us ensure the issue doesn’t regress in the future.

There are also some failing ui5-multi-input test cases that should be examined and fixed/adapted

@ndeshev
Copy link
Contributor

ndeshev commented Sep 7, 2025

Hello @Sumon249,
I've looked at the problem. The page reload in the example happens because the MultiInput is the single input element in a form.
And since the form has no action attribute to redirect to another URL - it gets reloaded.

The stopPropagation() solution is not ideal as it prevents the component consumers to handle its ENTER keydown event, for example for token creation - that was why some of the tests were failing.

On the other hand, the preventDefault() call on ENTER keydown seems to be exactly what we want - this prevents the default form submission behavior while still allowing event bubbling for token creation.

Thank you for submitting the issue and this pull-request. I created another based on this one - #12273 where I modified the fix and added some tests.

Kind regards,

Nikolay

@ndeshev ndeshev closed this Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MultiInput]: When in form, pressing Enter submits the form instead of just adding a token
3 participants