Page MenuHomePhabricator

Document how to wrap the Dialog component
Closed, ResolvedPublic3 Estimated Story Points

Description

@Sgs worked on a component that wraps the Dialog component, and suggested that we should document that with an example. Some things that are not super obvious:

  • You have to use useModelWrapper to wrap v-model:open; and useModelWrapper itself is not documented due to T295186
  • If you want to execute code when the dialog opens or closes, you should not listen to the update:open event; instead, you should use watch() on the open prop (or on its wrapper). The former only catches the dialog closing itself, the latter catches all changes.
  • There are other events like primary and default, to it's confusing that there's no close event. In an unwrapped scenario, it would be safe to listen to the update:open event, but I'd probably still recommend using a watcher for consistency
  • Update Dialog docs to explain how to listen for the dialog closing (using a watcher)
  • Add an example of a wrapped dialog component to the Dialog docs

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
egardner set the point value for this task to 3.
Restricted Application triaged this task as High priority. · View Herald TranscriptApr 5 2023, 4:25 PM
egardner changed the task status from Open to In Progress.Apr 6 2023, 6:53 PM

Change 906130 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[design/codex@main] docs: Add a wrapped Dialog example

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

Are we planning to use v-model:open as an API for other components that have a disclosure behavior? If so, maybe it would be worth to document the "wrap" pattern aside from the dialog example. I understand we use the "wrap" word here because it's a good physical metaphor but I wonder if we should avoid it in favor of "compose" or "reuse".

Change 906130 merged by jenkins-bot:

[design/codex@main] docs: Add a wrapped Dialog example

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

Change 907988 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[mediawiki/core@master] Update Codex from v0.8.0 to v0.9.0

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

Change 907988 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from v0.8.0 to v0.9.0

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

Test wiki created on Patch demo by KHarlan (WMF) using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/cfdfa13682/w

Test wiki on Patch demo by KHarlan (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/cfdfa13682/w/