FIX: Improve topic link click handling

The way we were handling clicks were not always passing topic ids to the
model. This should improve the flow and make it more consistent.
This commit is contained in:
Justin DiRose 2020-08-05 12:02:09 -05:00
parent 13ab415fb0
commit 80745b81c9
No known key found for this signature in database
GPG Key ID: 4B811FB264021800
1 changed files with 4 additions and 10 deletions

View File

@ -13,16 +13,10 @@ export default Ember.Component.extend({
},
// need to handle clicks here since links are in a raw view
didRender() {
const topicLinks = this.element.getElementsByClassName(
"knowledge-explorer-topic-link"
);
for (let i = 0, max = topicLinks.length; i < max; i++) {
topicLinks[i].addEventListener("click", e => {
const topicId = e.target.dataset.topicId;
this.selectTopic(topicId);
});
click(e) {
if (e.target.className === "knowledge-explorer-topic-link") {
const topicId = e.target.dataset.topicId;
this.selectTopic(topicId);
}
},