vmware-clarity / ng-clarity

Clarity Angular is a scalable, accessible, customizable, open-source design system built for Angular.

Home Page:https://clarity.design

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when press enter in combobox

tienthanhjlw opened this issue · comments

Describe the bug

While focusing in the input of a combobox, if the selection list is not open. When you press enter, the button's click handler function will be called.

How to reproduce

  1. Focus commbobox
  2. Press enter
<form clrForm clrLayout="vertical">
  <button (click)="handleClick($event)">Click Me</button>
  <clr-combobox [(ngModel)]="vertical.one" name="one" required [disabled]="disabled" aria-label="one" class="foo">
    <clr-options>
      <clr-option clrValue="1" id="custom-id-1">1</clr-option>
      <clr-option clrValue="2">2</clr-option>
      <clr-option clrValue="3">3</clr-option>
    </clr-options>
  </clr-combobox>
</form>

Expected behavior

A clear and concise description of what you expected to happen.

Versions

Clarity version:

  • v13.x
  • v15.x
  • Other:

Framework version:
ie: Angular 13, 15

Device:

  • Browser [e.g. chrome]

Isn't this normal HTML form behavior? When enter is pressed with an input is focused, the submit button is activated by the browser. Try making the button type="button" instead. (Buttons are submit buttons by default.)

oh thanks you so much! Sorry for the lack of understanding

Hi there 👋, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.