Skip to content

Commit 6b750e4

Browse files
ShGKmebackportbot[bot]
authored andcommitted
fix(NcEmojiPicker): return focus steals actual focus
Signed-off-by: Grigorii K. Shartsev <me@shgk.me> [skip ci]
1 parent 72901ee commit 6b750e4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/NcEmojiPicker/NcEmojiPicker.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,10 @@ export default {
407407
408408
afterHide() {
409409
// Manually return focus to the trigger button, as we disabled focus-trap
410-
this.$refs.popover.$el.querySelector('button, [role="button"]')?.focus()
410+
// But only if there is no focus target outside the picker, for example, input element that received focus by click closing the emoji picker
411+
if (!document.activeElement || this.$refs.picker.$el.contains(document.activeElement) || !isFocusable(document.activeElement)) {
412+
this.$refs.popover.$el.querySelector('button, [role="button"]')?.focus()
413+
}
411414
},
412415
413416
/**

0 commit comments

Comments
 (0)