Merge pull request #2118 from Bilb/fix-home-textbox

do not call home/end events if target is textbox
This commit is contained in:
Audric Ackermann 2021-12-21 10:06:18 +11:00 committed by GitHub
commit 326fb0e21c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,10 @@ import { CallNotification } from './message/message-item/notification-bubble/Cal
import { SessionLastSeenIndicator } from './SessionLastSeenIndicator';
import { TimerNotification } from './TimerNotification';
function isNotTextboxEvent(e: KeyboardEvent) {
return (e?.target as any)?.type === undefined;
}
export const SessionMessagesList = (props: {
scrollToQuoteMessage: (options: QuoteClickOptions) => Promise<void>;
onPageUpPressed: () => void;
@ -37,12 +41,16 @@ export const SessionMessagesList = (props: {
props.onPageDownPressed();
});
useKey('Home', () => {
props.onHomePressed();
useKey('Home', e => {
if (isNotTextboxEvent(e)) {
props.onHomePressed();
}
});
useKey('End', () => {
props.onEndPressed();
useKey('End', e => {
if (isNotTextboxEvent(e)) {
props.onEndPressed();
}
});
return (