Repository: atomiks/tippyjs (language: javascript)

Issue:
tippy.delegate + trigger:"click" + hideOnClick: true = immediately hides tippy on mobile
For mobile platforms (only chrome confirmed), if you use:

```
tippy.delegate(elem, {
   target: ".thing",
   trigger: "click",
   hideOnClick: true
})
```

...Then the tippy instance briefly appears and then disappears.

Using trigger: "focus" fixes it.

I've tried setting up my own click listener in onShow to recreate hideOnClick, but again, it is immediately triggered.
I think tippy must be listening for another event (appropriate for mobile) that fires momentarily before the "click" event, but internally it's still listening for "click" for hideOnClick, so it is immediately hidden.


Discussion / hints:

Fix patch:
diff --git a/src/addons/delegate.ts b/src/addons/delegate.ts
index 4e7e7376..e50aa700 100644
--- a/src/addons/delegate.ts
+++ b/src/addons/delegate.ts
@@ -39,7 +39,7 @@ function delegate(
 
   const nativeProps = removeProperties(props, ['target']);
   const parentProps = {...nativeProps, trigger: 'manual', touch: false};
-  const childProps = {...nativeProps, showOnCreate: true};
+  const childProps = {...defaultProps, ...nativeProps, showOnCreate: true};
 
   const returnValue = tippy(targets, parentProps);
   const normalizedReturnValue = normalizeToArray(returnValue);


Test patch:
diff --git a/test/integration/addons/delegate.test.js b/test/integration/addons/delegate.test.js
index 6a853fc3..399fcf22 100644
--- a/test/integration/addons/delegate.test.js
+++ b/test/integration/addons/delegate.test.js
@@ -191,4 +191,16 @@ describe('delegate', () => {
 
     expect(button._tippy.state.isVisible).toBe(true);
   });
+
+  it('does not hide tippy with touch input using click trigger', () => {
+    const button = h('button', {}, delegateElement);
+    instance = delegate(delegateElement, {target: 'button', trigger: 'click'});
+
+    fireEvent.touchStart(button, {bubbles: true});
+    fireEvent.click(button, {bubbles: true});
+
+    jest.runAllTimers();
+
+    expect(button._tippy.state.isVisible).toBe(true);
+  });
 });
diff --git a/test/visual/tests.js b/test/visual/tests.js
index 338a1d46..57c8b294 100644
--- a/test/visual/tests.js
+++ b/test/visual/tests.js
@@ -295,7 +295,7 @@ tests.delegate = () => {
 
   const instances = delegate('#delegate', {
     target: 'button',
-    touch: ['hold', 500],
+    trigger: 'click',
   });
 
   return () => instances.forEach((instance) => instance.destroy());