Page MenuHomePhabricator

Editor should not use OverlayManager.replaceCurrent
Open, Needs TriagePublic

Description

The replaceCurrent method has been an anti-pattern for some time. It replaces the existing overlay and updates OverlayManager internals. It can be avoided by using a wrapping component e.g. associate a single Overlay with a single element and use the promisedView to alter views within the overlay itself.

The only overlays using replaceCurrent are the category overlay (taken care of in the refactor T212465) and the editor overlays.

A proof of concept demonstrates what's possible without the replaceCurrent method in the codebase:
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MobileFrontend/+/616175

I (@Jdlrobson) can provide code if others who know the editor better can provide review.

Note: The category code using replaceCurrent is to be removed as part of T246049.

Event Timeline

JTannerWMF subscribed.

Hey @Jdlrobson , feel free to write the code and the Editing team will perform review when ready

Change 620127 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] WIP: Simplify editor switching to not use overlay manager replaceCurrent

https://gerrit.wikimedia.org/r/620127

Change 620127 abandoned by Jdlrobson:
[mediawiki/extensions/MobileFrontend@master] WIP: Simplify editor switching to not use overlay manager replaceCurrent

Reason:
Gonna try finding away to avoid having to touch the editor as part of a migration to Vue. Will make life a lot simpler.

https://gerrit.wikimedia.org/r/620127

Jdlrobson renamed this task from Editor and category overlays should not use OverlayManager.replaceCurrent to Editor should not use OverlayManager.replaceCurrent.Apr 27 2021, 9:44 PM
Jdlrobson updated the task description. (Show Details)