Add mobile/touch support (where hover doesn't exist)

This commit is contained in:
Joe Rickerby
2022-05-02 11:11:02 +01:00
parent 6d9a16376e
commit 960b069eb9
2 changed files with 19 additions and 4 deletions
+18 -4
View File
@@ -37,7 +37,6 @@
<div class="step" v-for="(step, sIndex) in diagram.steps">
<component v-for="action in step"
class="action"
v-bind:class="{hasHoverState: action.tooltip}"
v-bind:is="action.href ? 'a' : 'div'"
v-bind:href="action.href">
<div class="dots" v-if="action.style == 'dot'">
@@ -260,7 +259,7 @@
const tooltip = action.tooltip
if (tooltip) {
tippy(el, {
const tippyInstance = tippy(el, {
content: `
<div class="tooltip-title">
${tooltip.title || ''}
@@ -277,6 +276,21 @@
maxWidth: 'none',
appendTo: document.getElementById('flow-diagram'),
offset: [0, 10],
onShow() {
const stepEl = el.closest('.action')
stepEl.classList.add('tooltip-open')
},
onHide() {
const stepEl = el.closest('.action')
stepEl.classList.remove('tooltip-open')
}
})
el.addEventListener('touchend', e => {
e.preventDefault()
e.stopPropagation()
tippy.hideAll()
tippyInstance.show()
})
}
}
@@ -329,10 +343,10 @@
a.action {
color: inherit;
}
.action.hasHoverState:hover .dot-graphic {
.action.tooltip-open .dot-graphic {
background-color: #416EDA;
}
.action.hasHoverState:hover .block {
.action.tooltip-open .block {
background-color: #416EDA;
color: white;
}
+1
View File
@@ -3,6 +3,7 @@
body {
overflow-wrap: break-word;
overflow-x: hidden;
}
p {