FIX: cancel post toolbar on click outside (#23546)

On `mousedown` if the click is outside a cooked element cancel the `mousedown`/`mouseup` sequence and only rely on the `selectionchange` event.

This change ensures a click on avatar for example will work, even if user is doing a rather slow click (meaning: the mousedown has been hold for more than 100ms).
This commit is contained in:
Joffrey JAFFEUX 2023-09-12 18:49:06 +02:00 committed by GitHub
parent 9ac5e09179
commit a32fa3b947
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -233,9 +233,14 @@ export default class PostTextSelection extends Component {
}
@bind
async mousedown() {
this.isMousedown = true;
mousedown(event) {
this.holdingMouseDown = false;
if (!event.target.closest(".cooked")) {
return;
}
this.isMousedown = true;
this.holdingMouseDownHandler = discourseLater(() => {
this.holdingMouseDown = true;
}, 100);