mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Fix emoji picker closing when using pen/touch
This commit is contained in:
@@ -160,6 +160,12 @@ function getSelectedSection(
|
|||||||
return EmojiPickerCategory.SmileysAndPeople;
|
return EmojiPickerCategory.SmileysAndPeople;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isKeyboardPointerEvent(event: PointerEvent): boolean {
|
||||||
|
// "" means input source could not be determined (not mouse, pen, or touch)
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
||||||
|
return event.nativeEvent.pointerType === '';
|
||||||
|
}
|
||||||
|
|
||||||
export type FunEmojiSelection = Readonly<{
|
export type FunEmojiSelection = Readonly<{
|
||||||
variantKey: EmojiVariantKey;
|
variantKey: EmojiVariantKey;
|
||||||
}>;
|
}>;
|
||||||
@@ -664,8 +670,7 @@ const Cell = memo(function Cell(props: CellProps): JSX.Element {
|
|||||||
variantKey: emojiVariant.key,
|
variantKey: emojiVariant.key,
|
||||||
};
|
};
|
||||||
const shouldClose =
|
const shouldClose =
|
||||||
event.nativeEvent.pointerType !== 'mouse' &&
|
isKeyboardPointerEvent(event) && !(event.ctrlKey || event.metaKey);
|
||||||
!(event.ctrlKey || event.metaKey);
|
|
||||||
onSelectEmoji(emojiSelection, shouldClose);
|
onSelectEmoji(emojiSelection, shouldClose);
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user