AI reply menu: outside-click closer ignores clicks inside the menu
The document-level capture listener was closing the popover on ANY click — including clicks inside the context textarea, which made it impossible to focus the input. Replaced with an inline handler that bails when the click target is inside the menu.
This commit is contained in:
parent
3819a23344
commit
8f696064d5
1 changed files with 9 additions and 1 deletions
|
|
@ -5971,7 +5971,15 @@ function _showAiReplyChoice(btn, em, data) {
|
|||
// textarea stays focused.
|
||||
menu.addEventListener('mousedown', (ev) => ev.stopPropagation());
|
||||
document.body.appendChild(menu);
|
||||
setTimeout(() => document.addEventListener('click', _closeAiReplyChoice, true), 0);
|
||||
// Outside-click closer: only fires when the click target is OUTSIDE
|
||||
// the menu. The original handler closed on any click which made
|
||||
// focusing the textarea immediately dismiss the popover.
|
||||
const outsideClose = (ev) => {
|
||||
if (menu.contains(ev.target)) return;
|
||||
document.removeEventListener('click', outsideClose, true);
|
||||
_closeAiReplyChoice();
|
||||
};
|
||||
setTimeout(() => document.addEventListener('click', outsideClose, true), 0);
|
||||
}
|
||||
|
||||
function _handleAiReplyButton(ev, em, data) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue