From 2f4c8e0c624eba80ebbe08403034656e0396f139 Mon Sep 17 00:00:00 2001 From: Christopher Gurnee Date: Sat, 29 Jan 2022 10:01:10 -0500 Subject: [PATCH] Work around 8-year-old Firefox bug If the max comments setting was changed using only the spinner, it wasn't saved. See https://bugzilla.mozilla.org/show_bug.cgi?id=1012818 --- src/pages/thread/SortBy.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pages/thread/SortBy.js b/src/pages/thread/SortBy.js index b0bba5f..f8bb21a 100644 --- a/src/pages/thread/SortBy.js +++ b/src/pages/thread/SortBy.js @@ -3,6 +3,7 @@ import {connect, sort, filter, maxCommentsLimit} from '../../state' const sortBy = props => { const [reloadVisible, setReloadVisible] = useState(false) + const isFirefox = typeof InstallTrigger !== 'undefined' let usedMouse; return ( @@ -37,7 +38,11 @@ const sortBy = props => { setReloadVisible(parseInt(e.target.value) > props.global.state.maxComments && props.global.state.maxComments < maxCommentsLimit) }} onBlur={e => { e.target.value = props.global.saveMaxComments(e.target.value) - }} defaultValue={props.global.state.maxComments} type='number' maxLength='5' required min='100' max={maxCommentsLimit} step='100' /> + }} { + ...(isFirefox ? {onClick: e => { + e.target.focus() + }} : {}) + } defaultValue={props.global.state.maxComments} type='number' maxLength='5' required min='100' max={maxCommentsLimit} step='100' /> {reloadVisible && <> {props.global.loadMaxComments(); setReloadVisible(false)}} type='button' value='Reload' />