diff --git a/app/assets/javascripts/discourse/widgets/hooks.js.es6 b/app/assets/javascripts/discourse/widgets/hooks.js.es6 index b9c8c05f6d1..14b7cd0d962 100644 --- a/app/assets/javascripts/discourse/widgets/hooks.js.es6 +++ b/app/assets/javascripts/discourse/widgets/hooks.js.es6 @@ -51,11 +51,12 @@ function findWidget(node, attrName) { let _watchingDocument = false; let _dragging; -const DRAG_NAME = "mousemove.discourse-widget-drag"; +const DRAG_NAME = "mousemove.discourse-widget-drag"; +const DRAG_NAME_TOUCH = "touchmove.discourse-widget-drag"; function cancelDrag() { $('body').removeClass('widget-dragging'); - $(document).off(DRAG_NAME); + $(document).off(DRAG_NAME).off(DRAG_NAME_TOUCH); if (_dragging) { if (_dragging.dragEnd) { _dragging.dragEnd(); } @@ -66,17 +67,25 @@ function cancelDrag() { WidgetClickHook.setupDocumentCallback = function() { if (_watchingDocument) { return; } - $(document).on('mousedown.disource-widget', e => { + $(document).on('mousedown.discource-widget-drag, touchstart.discourse-widget-drag', e => { cancelDrag(); const widget = findWidget(e.target, DRAG_ATTRIBUTE_NAME); if (widget) { + e.preventDefault(); + e.stopPropagation(); _dragging = widget; $('body').addClass('widget-dragging'); $(document).on(DRAG_NAME, dragE => widget.drag(dragE)); + $(document).on(DRAG_NAME_TOUCH, dragE => { + const tt = dragE.originalEvent.targetTouches[0]; + if (tt) { + widget.drag(tt); + } + }); } }); - $(document).on('mouseup.discourse-widget-drag', () => cancelDrag()); + $(document).on('mouseup.discourse-widget-drag, touchend.discourse-widget-drag', () => cancelDrag()); $(document).on('click.discourse-widget', e => { nodeCallback(e.target, CLICK_ATTRIBUTE_NAME, w => w.click(e)); diff --git a/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 b/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 index 590601138fa..8182655de20 100644 --- a/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 +++ b/app/assets/javascripts/discourse/widgets/topic-timeline.js.es6 @@ -178,6 +178,9 @@ createWidget('topic-timeline-container', { buildAttributes(attrs) { if (attrs.dockAt) { + if (this.capabilities.isIOS) { + return { style: `display: none` }; + } return { style: `top: ${attrs.dockAt}px` }; };