diff --git a/packages/jui/src/InputField/Input.cy.tsx b/packages/jui/src/InputField/Input.cy.tsx index 9bdd62ea..989e5151 100644 --- a/packages/jui/src/InputField/Input.cy.tsx +++ b/packages/jui/src/InputField/Input.cy.tsx @@ -46,10 +46,28 @@ describe("Input", () => { cy.mount(); cy.wrap(ref).its("current").should("be.instanceOf", HTMLDivElement); }); + it("forwards ref to the input element", () => { const ref = React.createRef(); cy.mount(); cy.wrap(ref).its("current").should("be.instanceOf", HTMLInputElement); }); + + it("doesn't stop propagation of keyboard events", () => { + const onKeyDown = cy.stub(); + const onKeyUp = cy.stub(); + const onParentKeyDown = cy.stub(); + const onParentKeyUp = cy.stub(); + cy.mount( +
+ +
+ ); + cy.get("input").focus().type("a"); + cy.wrap(onKeyDown).should("be.calledOnce"); + cy.wrap(onKeyUp).should("be.calledOnce"); + cy.wrap(onParentKeyDown).should("be.calledOnce"); + cy.wrap(onParentKeyUp).should("be.calledOnce"); + }); }); }); diff --git a/packages/jui/src/InputField/Input.tsx b/packages/jui/src/InputField/Input.tsx index 779dfd07..28c64c99 100644 --- a/packages/jui/src/InputField/Input.tsx +++ b/packages/jui/src/InputField/Input.tsx @@ -146,8 +146,6 @@ export const Input = React.forwardRef(function Input( style, className, inputRef: inputRefProp, - onKeyDown, - onKeyUp, onFocus, onBlur, autoFocus, @@ -164,8 +162,6 @@ export const Input = React.forwardRef(function Input( autoFocus, onFocus, onBlur, - onKeyDown, - onKeyUp, } as FocusableOptions, inputRef );