Skip to content

Commit cccd926

Browse files
fix(poc3): Sped up question hover; it was laggy due to underspecific tippy selector
1 parent 4cc2e02 commit cccd926

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

app/poc3.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ <h2 class="title is-3">Case</h2>
172172
<p class="card-header-title title is-4">Driver's statement</p>
173173
</header>
174174
<div class="card-content">
175-
<div class="highlighted-text" v-html="highlightedQuestionnaireStatement">
175+
<div class="highlighted-text" id="statement" v-html="highlightedQuestionnaireStatement">
176176
</div>
177177
</div>
178178
</div>

app/poc3.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ createApp({
102102
this.selectedCase?.statement,
103103
response?.highlights ?? []
104104
)
105-
nextTick(() => {
106-
window.tippy('[data-tippy-content]');
107-
})
105+
this.enableNewTooltips('#statement span.passage')
108106
return ret
109107
},
110108
reviewRows() {
@@ -126,9 +124,7 @@ createApp({
126124
})
127125
}
128126

129-
nextTick(() => {
130-
window.tippy('[data-tippy-content]');
131-
})
127+
this.enableNewTooltips()
132128

133129
return ret
134130
},
@@ -295,5 +291,11 @@ createApp({
295291
onClickQuestion(question) {
296292
this.selectedQuestion = question
297293
},
294+
enableNewTooltips(selector) {
295+
selector = selector || ''
296+
nextTick(() => {
297+
window.tippy(`${selector}[data-tippy-content]`);
298+
})
299+
},
298300
}
299301
}).mount('#app')

0 commit comments

Comments
 (0)