Open Bug 2024753 Opened 8 months ago Updated 7 months ago

Remove React 16 addEventListener workarounds for moz-select and moz-reorderable-list in Lists widget

Categories

(Firefox :: New Tab Page, defect, P3)

defect

Tracking

()

People

(Reporter: maxx, Unassigned)

References

(Blocks 1 open bug)

Details

Summary:

The Lists widget uses useRef + useEffect + addEventListener to listen for change events on moz-select and reorder events on
moz-reorderable-list. This was required in React 16, which did not support custom element events via JSX props.

Now that newtab runs React 19 (Bug 2016217), these can be replaced with native JSX event props: onChange on <moz-select> and
onReorder on <moz-reorderable-list>.

Steps to fix:

  • content-src/components/Widgets/Lists/Lists.jsx:
    • remove selectRef and reorderListRef
    • delete the useEffect block (lines ~165–195)
    • move handleSelectChange and handleReorder to top-level functions
    • pass onChange={handleSelectChange} and onReorder={handleReorder} as JSX props on the respective elements.

This cannot be fully done until React 19 hits release.

Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.