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);
|
$: disabled = !$focusedInput || !editingInputIsRichText($focusedInput);
|
||||||
|
|
||||||
let showFloating = false;
|
let showFloating = false;
|
||||||
|
$: if (disabled) {
|
||||||
|
showFloating = false;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
|
@ -100,7 +103,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
<ButtonGroupItem>
|
<ButtonGroupItem>
|
||||||
<WithFloating
|
<WithFloating
|
||||||
show={showFloating && !disabled}
|
show={showFloating}
|
||||||
inline
|
inline
|
||||||
on:close={() => (showFloating = false)}
|
on:close={() => (showFloating = false)}
|
||||||
let:asReference
|
let:asReference
|
||||||
|
|
|
@ -76,10 +76,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
$: disabled = !$focusedInput || !editingInputIsRichText($focusedInput);
|
$: disabled = !$focusedInput || !editingInputIsRichText($focusedInput);
|
||||||
|
|
||||||
let showFloating = false;
|
let showFloating = false;
|
||||||
|
$: if (disabled) {
|
||||||
|
showFloating = false;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<WithFloating
|
<WithFloating
|
||||||
show={showFloating && !disabled}
|
show={showFloating}
|
||||||
closeOnInsideClick
|
closeOnInsideClick
|
||||||
inline
|
inline
|
||||||
on:close={() => (showFloating = false)}
|
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 disabled: boolean;
|
||||||
let showFloating = false;
|
let showFloating = false;
|
||||||
|
$: if (disabled) {
|
||||||
|
showFloating = false;
|
||||||
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const surroundElement = document.createElement("span");
|
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} />
|
<Shortcut {keyCombination} on:action={remove} />
|
||||||
|
|
||||||
<WithFloating
|
<WithFloating show={showFloating} inline on:close={() => (showFloating = false)}>
|
||||||
show={showFloating && !disabled}
|
|
||||||
inline
|
|
||||||
on:close={() => (showFloating = false)}
|
|
||||||
>
|
|
||||||
<IconButton
|
<IconButton
|
||||||
slot="reference"
|
slot="reference"
|
||||||
class="remove-format-button"
|
class="remove-format-button"
|
||||||
|
|
Loading…
Reference in a new issue