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

fix: stop touchstart event propagation if coming from cancel button in detached mode #924

Merged
merged 12 commits into from
Mar 31, 2022
2 changes: 1 addition & 1 deletion bundlesize.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"path": "packages/autocomplete-core/dist/umd/index.production.js",
"maxSize": "6 kB"
"maxSize": "6.25 kB"
},
{
"path": "packages/autocomplete-js/dist/umd/index.production.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/autocomplete-js/src/createAutocompleteDom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ export function createAutocompleteDom<TItem extends BaseItem>({
type: 'button',
sarahdayan marked this conversation as resolved.
Show resolved Hide resolved
class: classNames.detachedCancelButton,
textContent: translations.detachedCancelButtonText,
// Prevent environment `onTouchStart` behavior from closing the panel
// if it's initiated from this button
sarahdayan marked this conversation as resolved.
Show resolved Hide resolved
onTouchStart(event: TouchEvent) {
event.stopPropagation();
},
onClick(event: MouseEvent) {
event.stopPropagation();
sarahdayan marked this conversation as resolved.
Show resolved Hide resolved
autocomplete.setIsOpen(false);
Expand Down