Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(modals): support stacking modals, remove bootstrap modals dependency #3456

Merged
merged 29 commits into from
Aug 8, 2022

Conversation

jaspervriends
Copy link
Contributor

@jaspervriends jaspervriends commented Jun 10, 2022

Fixes #3516

Changes proposed in this pull request:
In this PR I've worked on making it possible to have multiple dialogs opened at the same time and make them stackable. I have partly used code of #3246 and altered it. It also removed the bootstrap modal dependency.

However, I did not proceed using the native HTML Dialog element for this PR due to lack of animations (for example, the backdrop is not animatable) and responsiveness with the interface.

A third parameter has been added to the app.modal.show function which is a boolean and defaults to false. This means that all already existing modals will keep their intended behaviour.

I also copied the new 'dismissable' options from the other PR, such as an option to hide the dialog on escape key, clicking on the backdrop or using the close button and managing them seperately per modal. This means there is a deprecation too which was mentioned in the code.

Reviewers should focus on:

  • Current modals are opening and closing as intended
  • Stacking multiple modals works
  • Responsiveness is still good

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Copy link
Member

@davwheat davwheat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments so far. Haven't had time to properly review yet.

framework/core/js/src/common/components/ModalManager.tsx Outdated Show resolved Hide resolved
framework/core/js/src/common/components/ModalManager.tsx Outdated Show resolved Hide resolved
framework/core/js/src/common/components/ModalManager.tsx Outdated Show resolved Hide resolved
framework/core/js/src/common/components/ModalManager.tsx Outdated Show resolved Hide resolved
framework/core/js/src/common/states/ModalManagerState.ts Outdated Show resolved Hide resolved
framework/core/js/src/common/components/ModalManager.tsx Outdated Show resolved Hide resolved
@jaspervriends
Copy link
Contributor Author

Thanks for the feedback, will work on it later this week

@jaspervriends
Copy link
Contributor Author

Processed feedback :)

@davwheat davwheat requested a review from SychO9 July 11, 2022 07:39
davwheat
davwheat previously approved these changes Jul 11, 2022
Copy link
Member

@davwheat davwheat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've addressed some things with commits on this PR, but would like a sanity check for my changes from another core dev before looking to merge this.

Thank you for your work on this! This is a big improvement for Flarum's modals system! :)

@davwheat davwheat changed the title Feature: Stackable modals and removed bootstrap dialogs feat(modals): support stacking modals, remove bootstrap modals dependency Jul 11, 2022
@davwheat davwheat self-assigned this Jul 11, 2022
@davwheat davwheat added this to the 1.5 milestone Jul 11, 2022
@davwheat davwheat added the type/accessibility Issues relating to accessibility (keyboard navigation, screenreaders, text contrast, etc.) label Jul 11, 2022
SychO9
SychO9 previously requested changes Jul 11, 2022
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good! a few comments and a bug I noticed. Thanks a lot for the PR!

There's an issue with the scrolling behavior, I think a video will better explain it:
https://user-images.githubusercontent.com/20267363/178266180-69aaa829-b528-4808-999f-4693bd15b3a5.mp4

framework/core/js/src/forum/components/LogInModal.tsx Outdated Show resolved Hide resolved
framework/core/less/common/Modal.less Outdated Show resolved Hide resolved
framework/core/js/src/common/states/ModalManagerState.ts Outdated Show resolved Hide resolved
@davwheat
Copy link
Member

davwheat commented Jul 14, 2022

oops... that was the wrong git command...

have asked jasper for write access to his fork so i can resurrect this. have a backup of the code at https://github.com/flarum/framework/tree/jv/stackable-modals

@davwheat davwheat reopened this Jul 14, 2022
@davwheat davwheat requested a review from SychO9 July 14, 2022 13:09
@davwheat
Copy link
Member

RE the scrolling bug: isn't this how the modals currently work in core?

uoKyaMOF.mp4

@SychO9
Copy link
Member

SychO9 commented Jul 14, 2022

yea but that isn't how they work in this branch 🙈 0:15 of my uploaded video shows behavior in this branch

@davwheat
Copy link
Member

OH I didn't watch for long enough! Right, I'll get on that.

@davwheat
Copy link
Member

@SychO9 Fixed, I hope.

@SychO9
Copy link
Member

SychO9 commented Jul 15, 2022

🙈 now you can't scroll inside a modal

@luceos luceos dismissed stale reviews from SychO9 and davwheat July 25, 2022 09:01

New changes

@luceos luceos self-requested a review July 25, 2022 09:02
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using one backdrop seems great! I think only small tweaks are left.

framework/core/less/common/Modal.less Outdated Show resolved Hide resolved
framework/core/less/common/Modal.less Outdated Show resolved Hide resolved
@luceos
Copy link
Member

luceos commented Jul 29, 2022

The patience in this PR is admirable.

@davwheat
Copy link
Member

davwheat commented Aug 8, 2022

Rebased on main.

@davwheat davwheat merged commit f69210b into flarum:main Aug 8, 2022
@davwheat
Copy link
Member

davwheat commented Aug 8, 2022

phew that was a big one 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-documentation type/accessibility Issues relating to accessibility (keyboard navigation, screenreaders, text contrast, etc.) type/cleanup type/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[A11Y] Add missing attributes to modal
4 participants