mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
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:
parent
9901ae428a
commit
f51d1590a1
3 changed files with 12 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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)}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue