Skip to content

Commit 7d2a0ca

Browse files
Merge pull request #39 from Travelopia/fix/multi-select-input-search
Fix Multi-Select
2 parents 7719a98 + 24d49f8 commit 7d2a0ca

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@travelopia/web-components",
3-
"version": "0.5.17",
3+
"version": "0.5.18",
44
"description": "Accessible web components for the modern web",
55
"files": [
66
"dist"

src/multi-select/tp-multi-select-pill.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,24 @@ export class TPMultiSelectPillElement extends HTMLElement {
1313
connectedCallback(): void {
1414
this.querySelector( 'button' )?.addEventListener( 'click', this.handleButtonClick.bind( this ) );
1515
}
16-
1716
/**
1817
* Handle button click.
1918
*
20-
* @param {Event} e Click event.
19+
* @param {any} e Click event.
2120
*/
22-
handleButtonClick( e: Event | null ): void {
21+
handleButtonClick( e: any | null ): void {
2322
e?.preventDefault();
2423
e?.stopPropagation();
25-
this.removePill();
24+
25+
/**
26+
* If the event is has a pointerType, which means it's a mouse event or touch event
27+
* Only then we remove pill.
28+
* This will ensure, it will not get fired when a enter button is pressed.
29+
* We do this so that it does not remove the pills when enter button is pressed.
30+
*/
31+
if ( e?.pointerType ) {
32+
this.removePill();
33+
}
2634
}
2735

2836
/**

0 commit comments

Comments
 (0)