Page MenuHomePhabricator

[web] [fix] [ENG-716] use cross icon in modal
ClosedPublic

Authored by benschac on Apr 4 2022, 2:46 PM.
Tags
None
Referenced Files
F2905655: D3616.diff
Sun, Oct 6, 7:22 AM
Unknown Object (File)
Mon, Sep 23, 11:08 AM
Unknown Object (File)
Mon, Sep 23, 4:06 AM
Unknown Object (File)
Mon, Sep 23, 4:06 AM
Unknown Object (File)
Mon, Sep 23, 4:05 AM
Unknown Object (File)
Mon, Sep 23, 4:05 AM
Unknown Object (File)
Mon, Sep 23, 4:05 AM
Unknown Object (File)
Mon, Sep 23, 4:05 AM

Diff Detail

Repository
rCOMM Comm
Branch
arcpatch-D3616
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

benschac retitled this revision from [web] [fix] use cross icon in modal to [web] [fix] [ENG-716] use cross icon in modal.
benschac edited the summary of this revision. (Show Details)
tomek requested changes to this revision.Apr 6 2022, 7:29 AM
tomek added inline comments.
web/modals/modal.react.js
15 ↗(On Diff #11084)

Why is it a Node? We're checking only if it is present so this can be a boolean.

Also, the naming is confusing. Starting the name with on suggests it's a callback.

This revision now requires changes to proceed.Apr 6 2022, 7:29 AM
tomek requested changes to this revision.Apr 7 2022, 11:24 PM
tomek added inline comments.
web/modals/modal.react.js
15 ↗(On Diff #11084)

What do you think about the second question (naming)?

This revision now requires changes to proceed.Apr 7 2022, 11:24 PM

Agree with Tomek about naming – onCloseButton sounds like a callback that gets called when a button is closed

web/modals/modal.react.js
56–60 ↗(On Diff #11183)

Breaks ternary rule #3, see here:

Either the whole expression should fit on one line, or the ? and : characters should appear at the start of subsequent lines.

web/modals/modal.react.js
15 ↗(On Diff #11084)

would handle be better?

tomek requested changes to this revision.Apr 12 2022, 1:37 AM
tomek added inline comments.
web/modals/modal.react.js
15 ↗(On Diff #11084)

It might be a little confusing by suggesting that this modal does something special when handling the close button. It looks like we're deciding if we want to show the close button, so e.g. showCloseButton might be slightly better, but it also sounds like an action. An even better name could be withCloseButton - I really like that because it can be read really well when used e.g. <Modal withCloseButton /> - which means exactly what is said. We can also consider something like isCloseButtonVisible or hasCloseButton.

One idea we can consider is to not introduce this prop at all and instead to make onClose optional. Then, based on presence of this function, decide if we want the button. What do you think?

This revision now requires changes to proceed.Apr 12 2022, 1:37 AM

I think optional onClose makes the most sense.

tomek requested changes to this revision.Apr 13 2022, 12:18 AM

I think optional onClose makes the most sense.

Looking at the code, I think my suggestion was wrong... sorry for that. If we make onClose optional and decide to not set it, there would be no way to close the modal, e.g. when clicking outside of it. I think we should reintroduce the boolean prop and make onClose mandatory

This revision now requires changes to proceed.Apr 13 2022, 12:18 AM
tomek requested changes to this revision.Apr 14 2022, 1:09 AM

While rebasing, you reintroduced the version with optional onClick

This revision now requires changes to proceed.Apr 14 2022, 1:09 AM
This revision is now accepted and ready to land.Apr 14 2022, 10:48 AM

Looks like this change affected ThreadSettingsModal. For that modal we definitely want to keep the "X" button so the user can leave the modal without having to save changes.

I think we should have either:

A. Enabled the close button by default
B. Gone through the existing modals and made sure that they continue to look as they did prior. Making withCloseButton a mandatory prop may be a good way to surface all of the modals that need to be looked at.

@atul, did you create a task to track the regression introduced by this diff? Please always create a task for something that needs to be followed up on, and please always share a link to that task when leaving a comment referencing a required follow-up.