File tree Expand file tree Collapse file tree 2 files changed +23
-9
lines changed
utils/keyboard-controls/src Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
1616 useSnackbar ,
1717 Manager ,
1818 Icon ,
19+ Input ,
1920} from "react-ck" ;
2021import { faker } from "@faker-js/faker" ;
2122import { IconVerticalDots } from "@react-ck/icon/icons/IconVerticalDots" ;
@@ -301,12 +302,15 @@ const Counter = (): React.ReactElement => {
301302 ) ;
302303} ;
303304
304- const SelectField = ( ) : React . ReactElement => (
305- < Select placeholder = "Select" >
306- < Select . Option > 1</ Select . Option >
307- < Select . Option > 2</ Select . Option >
308- < Select . Option > 3</ Select . Option >
309- </ Select >
305+ const Fields = ( ) : React . ReactElement => (
306+ < >
307+ < Input placeholder = "Input" />
308+ < Select placeholder = "Select" >
309+ < Select . Option > 1</ Select . Option >
310+ < Select . Option > 2</ Select . Option >
311+ < Select . Option > 3</ Select . Option >
312+ </ Select >
313+ </ >
310314) ;
311315
312316const AllItems = ( { children } : { readonly children : React . ReactNode } ) : React . ReactElement => {
@@ -355,14 +359,14 @@ const App = (): React.ReactElement => (
355359
356360 < Counter />
357361
358- < SelectField />
362+ < Fields />
359363
360364 < AllItems >
361365 < Text > { faker . lorem . paragraph ( ) } </ Text >
362366
363367 < Counter />
364368
365- < SelectField />
369+ < Fields />
366370
367371 < Actions />
368372 </ AllItems >
Original file line number Diff line number Diff line change @@ -60,7 +60,17 @@ export class KeyboardControls {
6060 private handleFocusWithArrows = ( e : KeyboardEvent ) : void => {
6161 const currentElement = document . activeElement ;
6262
63- if ( ! currentElement ) return ;
63+ // skip if no focused element
64+ // or content editable element
65+ // or current element is an input or textarea with value
66+ if (
67+ ! currentElement ||
68+ ( currentElement instanceof HTMLElement && currentElement . isContentEditable ) ||
69+ ( currentElement instanceof HTMLInputElement &&
70+ currentElement . value &&
71+ ( currentElement . tagName === "INPUT" || currentElement . tagName === "TEXTAREA" ) )
72+ )
73+ return ;
6474
6575 const { focusableElements } = getFocusableElements ( {
6676 container : this . container ,
You can’t perform that action at this time.
0 commit comments