Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 841abc2

Browse files
committed
Roving Tab Index should not interfere with inputs
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 5a4ca45 commit 841abc2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/accessibility/RovingTabIndex.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ export const RovingTabIndexProvider: React.FC<IProps> = ({children, handleHomeEn
166166

167167
const onKeyDownHandler = useCallback((ev) => {
168168
let handled = false;
169-
if (handleHomeEnd) {
169+
// Don't interfere with input default keydown behaviour
170+
if (handleHomeEnd && ev.target.tagName !== "INPUT") {
170171
// check if we actually have any items
171172
switch (ev.key) {
172173
case Key.HOME:

src/accessibility/Toolbar.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ interface IProps extends Omit<React.HTMLProps<HTMLDivElement>, "onKeyDown"> {
2828
const Toolbar: React.FC<IProps> = ({children, ...props}) => {
2929
const onKeyDown = (ev: React.KeyboardEvent, state: IState) => {
3030
const target = ev.target as HTMLElement;
31+
// Don't interfere with input default keydown behaviour
32+
if (target.tagName === "INPUT") return;
33+
3134
let handled = true;
3235

3336
// HOME and END are handled by RovingTabIndexProvider

0 commit comments

Comments
 (0)