File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
packages/propel/src/emoji-icon-picker Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,19 @@ export function EmojiPicker(props: TCustomEmojiPicker) {
108108 align = { finalAlign }
109109 sideOffset = { 8 }
110110 data-prevent-outside-click = "true"
111+ onMouseDown = { ( e ) => e . stopPropagation ( ) }
112+ onClick = { ( e ) => e . stopPropagation ( ) }
113+ onFocus = { ( e ) => e . stopPropagation ( ) }
114+ onKeyDown = { ( e ) => {
115+ if ( e . key === "Tab" ) {
116+ return ;
117+ }
118+ if ( e . key === "Escape" ) {
119+ handleToggle ( false ) ;
120+ return ;
121+ }
122+ e . stopPropagation ( ) ;
123+ } }
111124 >
112125 < Tabs . Root defaultValue = { defaultOpen } >
113126 < Tabs . List className = "grid grid-cols-2 gap-1 px-3.5 pt-3" >
Original file line number Diff line number Diff line change 1+ import { useEffect , useRef } from "react" ;
12import { EmojiPicker } from "frimousse" ;
23import { cn } from "../../utils" ;
34
@@ -9,14 +10,29 @@ type EmojiRootProps = {
910
1011export function EmojiRoot ( props : EmojiRootProps ) {
1112 const { onChange, searchPlaceholder = "Search" , searchDisabled = false } = props ;
13+ const searchWrapperRef = useRef < HTMLDivElement > ( null ) ;
14+ useEffect ( ( ) => {
15+ const focusInput = ( ) => {
16+ const searchWrapper = searchWrapperRef . current ;
17+ if ( searchWrapper ) {
18+ const inputElement = searchWrapper . querySelector ( "input" ) ;
19+ if ( inputElement ) {
20+ inputElement . removeAttribute ( "disabled" ) ;
21+ inputElement . focus ( ) ;
22+ }
23+ }
24+ } ;
25+ focusInput ( ) ;
26+ } , [ ] ) ;
27+
1228 return (
1329 < EmojiPicker . Root
1430 data-slot = "emoji-picker"
1531 className = "isolate flex flex-col rounded-md h-full w-full border-none p-2"
1632 onEmojiSelect = { ( val ) => onChange ( val . emoji ) }
1733 >
1834 < div className = "flex items-center gap-2 justify-between [&>[data-slot='emoji-picker-search-wrapper']]:flex-grow [&>[data-slot='emoji-picker-search-wrapper']]:p-0 px-1.5 py-2 sticky top-0 z-10 bg-custom-background-100" >
19- < div data-slot = "emoji-picker-search-wrapper" className = "p-2" >
35+ < div ref = { searchWrapperRef } data-slot = "emoji-picker-search-wrapper" className = "p-2" >
2036 < EmojiPicker . Search
2137 placeholder = { searchPlaceholder }
2238 disabled = { searchDisabled }
You can’t perform that action at this time.
0 commit comments