From dc2aa6ae827023ea15fe427e776193c08cbc77c7 Mon Sep 17 00:00:00 2001 From: Plastikmensch Date: Sun, 5 Nov 2023 05:27:15 +0100 Subject: [PATCH] Fix keyboard navigation changing settings in App settings When using keyboard navigation `onBlur` and `onChange` on radio buttons caused settings to be changed. Uses `onClick` instead and replaces `onChange` with a noop to prevent react from complaining. Signed-off-by: Plastikmensch --- .../glitch/features/local_settings/page/item/index.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx b/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx index 15dce634d21fc7..af99537dc254a8 100644 --- a/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx +++ b/app/javascript/flavours/glitch/features/local_settings/page/item/index.jsx @@ -33,8 +33,10 @@ export default class LocalSettingsPageItem extends PureComponent { else onChange(item, target.checked); }; + noop = () => {}; + render () { - const { handleChange } = this; + const { handleChange, noop } = this; const { settings, item, id, inputProps, options, children, dependsOn, dependsOnNot, placeholder, disabled } = this.props; let enabled = !disabled; @@ -60,8 +62,8 @@ export default class LocalSettingsPageItem extends PureComponent { name={id} id={optionId} value={opt.value} - onBlur={handleChange} - onChange={handleChange} + onClick={handleChange} + onChange={noop} checked={currentValue === opt.value} disabled={!enabled} {...inputProps}