File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/components/NcEmojiPicker Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,7 @@ This component allows the user to pick an emoji.
192192</template >
193193
194194<script >
195+ import { isFocusable } from ' tabbable'
195196import { getCurrentSkinTone , setCurrentSkinTone } from ' ../../functions/emoji/emoji.ts'
196197import { useTrapStackControl } from ' ../../composables/useTrapStackControl.ts'
197198import { Color } from ' ../../utils/GenColors.js'
@@ -407,7 +408,10 @@ export default {
407408
408409 afterHide () {
409410 // Manually return focus to the trigger button, as we disabled focus-trap
410- this .$refs .popover .$el .querySelector (' button, [role="button"]' )? .focus ()
411+ // But only if there is no focus target outside the picker, for example, input element that received focus by click closing the emoji picker
412+ if (! document .activeElement || this .$refs .picker .$el .contains (document .activeElement ) || ! isFocusable (document .activeElement )) {
413+ this .$refs .popover .$el .querySelector (' button, [role="button"]' )? .focus ()
414+ }
411415 },
412416
413417 /**
You can’t perform that action at this time.
0 commit comments