Skip to content

[slider] onChange throws "Failed to construct 'TextEvent': Illegal constructor" when the event can't be re-constructed #49970

Backlog

Description

@navot-tomorrow

Steps to reproduce

Steps:
1.Render a controlled <Slider value={v} onChange={(e, v) => setV(v)} />.
2.Open the page through a browser-isolation product that replays input as TextEvent. We saw it with Menlo Security. The same thing happens whenever the slider’s native event is a type whose constructor is illegal.
3.Move the slider.

new TextEvent('textInput', {}); // TypeError: Failed to construct 'TextEvent': Illegal constructor

useSlider runs new nativeEvent.constructor(nativeEvent.type, nativeEvent) on every change, so any native event of that type makes it throw.

Current behavior

handleChange throws TypeError: Failed to construct 'TextEvent': Illegal constructor before onChange is called. The error is unhandled, the value doesn’t change, and the slider can’t be moved for that user.

Expected behavior

Changing the value should never throw because the event couldn’t be copied. If copying fails, fall back to the original event, or to a plain Event with the overridden target.

Context

useSlider.ts:
const nativeEvent = 'nativeEvent' in event ? event.nativeEvent : event;
const clonedEvent = new (nativeEvent.constructor as typeof Event)(nativeEvent.type, nativeEvent as EventInit);
The same pattern broke Select and Slider in IE11 (#27631), where the fix question was left open. Suggested guard:
let clonedEvent: Event;
try {
clonedEvent = new (nativeEvent.constructor as typeof Event)(nativeEvent.type, nativeEvent as EventInit);
} catch {
clonedEvent = new Event(nativeEvent.type, nativeEvent as EventInit);
}

In production we see this on a map timeline slider, only for users behind Menlo Security browser isolation, on Chrome 156 for Windows. SelectInput has the same copy and may need the same guard.

Your environment

run npx @mui/envinfo in map-widget and paste the output. We use @mui/material 5.16.14, and the copy is unchanged on master.

Search keywords: slider TextEvent Illegal constructor clonedEvent nativeEvent.constructor

Activity

  1. added
    status: waiting for maintainer
    on Dec 4, 2026
  2. added
    type: bug
    scope: slider
    and removed
    status: waiting for maintainer
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: slidertype: bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions