mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-26 18:48:15 +02:00
Fix Bug #533 - Filter menu does not disappear when clicked for a second time (Board > Filter) (#4050)
Co-authored-by: White Hsu <white@glints.com>
This commit is contained in:
parent
33d7469002
commit
3e494e0b0a
@ -65,6 +65,7 @@ type Props = {
|
||||
|
||||
const ViewHeader = (props: Props) => {
|
||||
const [showFilter, setShowFilter] = useState(false)
|
||||
const [lockFilterOnClose, setLockFilterOnClose] = useState(false)
|
||||
const intl = useIntl()
|
||||
const canEditBoardProperties = useHasCurrentBoardPermissions([Permission.ManageBoardProperties])
|
||||
|
||||
@ -197,7 +198,9 @@ const ViewHeader = (props: Props) => {
|
||||
<ModalWrapper>
|
||||
<Button
|
||||
active={hasFilter}
|
||||
onClick={() => setShowFilter(true)}
|
||||
onClick={() => setShowFilter(!showFilter)}
|
||||
onMouseOver={() => setLockFilterOnClose(true)}
|
||||
onMouseLeave={() => setLockFilterOnClose(false)}
|
||||
>
|
||||
<FormattedMessage
|
||||
id='ViewHeader.filter'
|
||||
@ -208,7 +211,11 @@ const ViewHeader = (props: Props) => {
|
||||
<FilterComponent
|
||||
board={board}
|
||||
activeView={activeView}
|
||||
onClose={() => setShowFilter(false)}
|
||||
onClose={() => {
|
||||
if (!lockFilterOnClose) {
|
||||
setShowFilter(false)
|
||||
}
|
||||
}}
|
||||
/>}
|
||||
</ModalWrapper>
|
||||
|
||||
|
@ -7,6 +7,8 @@ import {Utils} from '../../utils'
|
||||
|
||||
type Props = {
|
||||
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void
|
||||
onMouseOver?: (e: React.MouseEvent<HTMLButtonElement>) => void
|
||||
onMouseLeave?: (e: React.MouseEvent<HTMLButtonElement>) => void
|
||||
onBlur?: (e: React.FocusEvent<HTMLButtonElement>) => void
|
||||
children?: React.ReactNode
|
||||
title?: string
|
||||
@ -37,6 +39,8 @@ function Button(props: Props): JSX.Element {
|
||||
<button
|
||||
type={props.submit ? 'submit' : 'button'}
|
||||
onClick={props.onClick}
|
||||
onMouseOver={props.onMouseOver}
|
||||
onMouseLeave={props.onMouseLeave}
|
||||
className={Utils.generateClassName(classNames)}
|
||||
title={props.title}
|
||||
onBlur={props.onBlur}
|
||||
|
Loading…
x
Reference in New Issue
Block a user