Fix possible unexpected flash of pop-up menu (#2274)

When a pop-up menu was closed by clicking on an empty space
outside the fields, the variable controlling the display state
was not changed, causing the pop-up menu to flash momentarily
the next time a field was focused.
This commit is contained in:
Hikaru Y 2022-12-19 11:07:47 +09:00 committed by GitHub
parent 9901ae428a
commit f51d1590a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View file

@ -72,6 +72,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$: disabled = !$focusedInput || !editingInputIsRichText($focusedInput);
let showFloating = false;
$: if (disabled) {
showFloating = false;
}
</script>
<ButtonGroup>
@ -100,7 +103,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<ButtonGroupItem>
<WithFloating
show={showFloating && !disabled}
show={showFloating}
inline
on:close={() => (showFloating = false)}
let:asReference

View file

@ -76,10 +76,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$: disabled = !$focusedInput || !editingInputIsRichText($focusedInput);
let showFloating = false;
$: if (disabled) {
showFloating = false;
}
</script>
<WithFloating
show={showFloating && !disabled}
show={showFloating}
closeOnInsideClick
inline
on:close={() => (showFloating = false)}

View file

@ -62,6 +62,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let disabled: boolean;
let showFloating = false;
$: if (disabled) {
showFloating = false;
}
onMount(() => {
const surroundElement = document.createElement("span");
@ -114,11 +117,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<Shortcut {keyCombination} on:action={remove} />
<WithFloating
show={showFloating && !disabled}
inline
on:close={() => (showFloating = false)}
>
<WithFloating show={showFloating} inline on:close={() => (showFloating = false)}>
<IconButton
slot="reference"
class="remove-format-button"