Skip to content

Typing a backslash in the control searcher crashes the docs page #19976

Description

@pvdstel

Environment Information

  • Package version(s): Fluent UI React 8.34.6 (listed in the docs dropdown), although I doubt the problem lies with the Fluent UI React package.
  • Browser and OS versions: Firefox 93.0b9, Edge 93.0.961.52

Link to the page: https://developer.microsoft.com/en-us/fluentui#/controls/web/button

Please provide a reproduction of the bug in a codepen:

Not exactly a codepen, but I pressed the wrong key while searching for the dropdown control, and pressed the backslash (\) button on my keyboard. The documentation page crashed with a React error in the dev tools.

backslash-death

Actual behavior:

The documentation page crashes with a React error in the dev tools console.

SyntaxError: \ at end of pattern
    _renderLink fabric-site.min.js:1
    r fabric-site.min.js:1
    _renderLinkList fabric-site.min.js:1
    _renderSortedLinks fabric-site.min.js:1
    _renderPageNav fabric-site.min.js:1
    render fabric-site.min.js:1
    wi fabric-site.min.js:1
    [truncated]

Expected behavior:

The documentation should does not crash when a backslash appears in the search text.

Priorities and help requested:

Are you willing to submit a PR to fix? No. I have looked at the Link component for a bit, to see if that happened to cause it, which doesn't seem to be the case. But I'm not currently planning to dive into the code for the docs website. Edit: the crash seems to occur with any reserved regex character. Escaping, or not using a regex to search for controls might do the trick.

Requested priority: Low. Not really something that impacts me a lot, it's just a small bug that I imagine you'd want to remove from your docs page 😄

Products/sites affected: the Fluent UI React documentation website. I'm not aware of any other products/sites.

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions