[Glitch] Allow keyboard modal form submission
Port 03045425b7323e8ce4e6ce81942d798a500c655a to glitch-soc Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
b08e2b8e60
commit
f37da7d231
@ -1,7 +1,6 @@
|
|||||||
.input {
|
.input {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: block;
|
display: block;
|
||||||
resize: vertical;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px 16px;
|
padding: 10px 16px;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
@ -50,6 +49,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea.input {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
.iconWrapper {
|
.iconWrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,17 @@
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
import { polymorphicForwardRef } from '@/types/polymorphic';
|
||||||
|
|
||||||
interface ModalShellProps {
|
interface ModalShellProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ModalShell: React.FC<ModalShellProps> = ({
|
export const ModalShell = polymorphicForwardRef<'form', ModalShellProps>(
|
||||||
children,
|
({ as: Comp = 'form', children, className, ...restProps }, ref) => (
|
||||||
className,
|
<Comp
|
||||||
}) => {
|
{...restProps}
|
||||||
return (
|
ref={ref}
|
||||||
<div
|
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'modal-root__modal',
|
'modal-root__modal',
|
||||||
'safety-action-modal',
|
'safety-action-modal',
|
||||||
@ -18,9 +19,10 @@ export const ModalShell: React.FC<ModalShellProps> = ({
|
|||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</Comp>
|
||||||
);
|
),
|
||||||
};
|
);
|
||||||
|
ModalShell.displayName = 'ModalShell';
|
||||||
|
|
||||||
export const ModalShellBody: React.FC<ModalShellProps> = ({
|
export const ModalShellBody: React.FC<ModalShellProps> = ({
|
||||||
children,
|
children,
|
||||||
|
|||||||
@ -100,7 +100,7 @@ export const AccountJoinModal: FC<{
|
|||||||
}, [anniversary, handle, dispatch, isMe]);
|
}, [anniversary, handle, dispatch, isMe]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalShell className={classes.joinShell}>
|
<ModalShell as='div' className={classes.joinShell}>
|
||||||
<ModalShellBody className={classes.joinWrapper}>
|
<ModalShellBody className={classes.joinWrapper}>
|
||||||
<AccountAnniversaryImage anniversary={anniversary} />
|
<AccountAnniversaryImage anniversary={anniversary} />
|
||||||
|
|
||||||
|
|||||||
@ -73,7 +73,7 @@ export const ConfirmationModal: React.FC<
|
|||||||
}, [onClose, onSecondary]);
|
}, [onClose, onSecondary]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalShell>
|
<ModalShell onSubmit={handleClick}>
|
||||||
<ModalShellBody className={className}>
|
<ModalShellBody className={className}>
|
||||||
<h1 id={titleId}>{title}</h1>
|
<h1 id={titleId}>{title}</h1>
|
||||||
{message && <p>{message}</p>}
|
{message && <p>{message}</p>}
|
||||||
@ -107,6 +107,7 @@ export const ConfirmationModal: React.FC<
|
|||||||
|
|
||||||
{/* eslint-disable jsx-a11y/no-autofocus -- we are in a modal and thus autofocusing is justified */}
|
{/* eslint-disable jsx-a11y/no-autofocus -- we are in a modal and thus autofocusing is justified */}
|
||||||
<Button
|
<Button
|
||||||
|
type='submit'
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
loading={updating}
|
loading={updating}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user