Skip to content

SearchBox swallows ESC keyDown events, cannot be handled outside #12447

@sachin9996

Description

@sachin9996

Environment Information

  • Package version(s): Office UI Fabric React 7.100.0
  • Browser and OS versions: Should repro on all browsers

Describe the issue:

The SearchBox component has an onEscape handler that handles what happens when the ESC key is pressed. However this ESC keyDown event doesn't seem to bubble outside the SearchBox.

My use case is a dialog with a SearchBox inside it. When focus is on the SearchBox and there is some input in it, pressing ESC should clear the input (this part works fine and is default SearchBox behavior). But when the SearchBox is empty, pressing ESC should close the dialog, and this is something that needs to be handled at the level of the dialog.

(See linked codepen for more details)

Actual behavior:

The onEscapeKeyDown handler isn't called.

Expected behavior:

The onEscapeKeyDown handler should be called.

If applicable, please provide a codepen repro:

https://codepen.io/sachin9996/pen/gOpQEWo?editors=1111

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? No

Requested priority: Normal

Products/sites affected: Power Query Online

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions