FIX: allow to click on thread indicator (#24821)

We can also now control tabindex, and other html attributes, which allows to lick on the thread indicator but not tab to it for example.

By default the tabindex will be 0.
This commit is contained in:
Joffrey JAFFEUX
2023-12-11 16:35:29 +01:00
committed by GitHub
parent a7a4aaa6b9
commit dacb06842e
2 changed files with 15 additions and 21 deletions

View File

@@ -27,10 +27,6 @@ export default class ChatMessageThreadIndicator extends Component {
return this.args.interactiveUser ?? true;
}
get interactiveThread() {
return this.args.interactiveThread ?? true;
}
@action
setup(element) {
this.element = element;
@@ -46,15 +42,13 @@ export default class ChatMessageThreadIndicator extends Component {
this.element.addEventListener("touchCancel", this.cancelTouch);
}
if (this.interactiveThread) {
this.element.addEventListener("mousedown", this.openThread, {
passive: true,
});
this.element.addEventListener("mousedown", this.openThread, {
passive: true,
});
this.element.addEventListener("keydown", this.openThread, {
passive: true,
});
}
this.element.addEventListener("keydown", this.openThread, {
passive: true,
});
}
@action
@@ -70,15 +64,13 @@ export default class ChatMessageThreadIndicator extends Component {
this.element.removeEventListener("touchCancel", this.cancelTouch);
}
if (this.interactiveThread) {
this.element.removeEventListener("mousedown", this.openThread, {
passive: true,
});
this.element.removeEventListener("mousedown", this.openThread, {
passive: true,
});
this.element.removeEventListener("keydown", this.openThread, {
passive: true,
});
}
this.element.removeEventListener("keydown", this.openThread, {
passive: true,
});
}
@bind
@@ -142,7 +134,8 @@ export default class ChatMessageThreadIndicator extends Component {
{{willDestroy this.teardown}}
role="button"
title={{i18n "chat.threads.open"}}
tabindex={{if this.interactiveThread "0" "-1"}}
tabindex="0"
...attributes
>
<div class="chat-message-thread-indicator__last-reply-avatar">

View File

@@ -89,6 +89,7 @@ export default class UserThreads extends Component {
@message={{thread.originalMessage}}
@interactiveUser={{false}}
@interactiveThread={{false}}
tabindex="-1"
/>
</div>
</div>