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

Re-implement Modal component using HTMLDialogElement (#461) #544

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bedrich-schindler
Copy link
Contributor

@bedrich-schindler bedrich-schindler commented May 30, 2024

Closes #461, closes #537.

@mbohal mbohal self-requested a review June 3, 2024 08:43
src/theme.scss Outdated Show resolved Hide resolved
src/components/Modal/Modal.module.scss Outdated Show resolved Hide resolved
src/components/Modal/__tests__/Modal.test.jsx Outdated Show resolved Hide resolved
@bedrich-schindler
Copy link
Contributor Author

bedrich-schindler commented Jun 3, 2024

Update CSS properties in README.md.

Done ✅

Copy link
Member

@adamkudrna adamkudrna left a comment

Choose a reason for hiding this comment

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

Nice job! 👏🏻 Even with the decision of not having the closed Modal in the DOM. 👍

I just think we cannot remove the click-on-backdrop-to-close functionality.

src/components/Modal/Modal.jsx Outdated Show resolved Hide resolved
src/components/Modal/Modal.jsx Outdated Show resolved Hide resolved
src/components/Modal/Modal.jsx Outdated Show resolved Hide resolved
src/components/Modal/Modal.jsx Outdated Show resolved Hide resolved
src/components/Modal/Modal.jsx Show resolved Hide resolved
src/components/Modal/Modal.module.scss Outdated Show resolved Hide resolved
src/components/Modal/_settings.scss Outdated Show resolved Hide resolved
src/components/Modal/__tests__/Modal.test.jsx Show resolved Hide resolved
| `--rui-Modal--large__width` | Width of large modal |
| `--rui-Modal--fullscreen__width` | Width of fullscreen modal |
| `--rui-Modal--fullscreen__height` | Height of fullscreen modal |
| `--rui-Modal__animation__duration` | Duration of animation used (when opening modal) |
Copy link
Member

Choose a reason for hiding this comment

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

when opening modal

Currently, closing of Modal is not animated because the component is simply removed from the DOM.

@mbohal Do we also want animated closing? That would mean delayed removal from the DOM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to add one thing. Closing animation is hard to impelement. We do not have close handler, we have closeButtonRef. I tried to implement it somehow today but without success. So it is up to our decision whether we want to spend some time on it or not.

Copy link
Member

@adamkudrna adamkudrna Jun 17, 2024

Choose a reason for hiding this comment

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

obrazek

I'd expect more deletions than additions. 😞 Can we get rid of some more features custom code in our focus management? Or anywhere else?

@bedrich-schindler
Copy link
Contributor Author

PR updated:

* Introduced allowCloseOnBackdropClick and allowCloseOnEscapeKey prop, both set to true by default. It allows end-user to configure modal in such way that he/she can prevent closing by clicking on backdrop or pressing Escape key.
* Improved blocking of firing click events on primary and close button as there were missing conditions checking whether the button is disabled (it was there for a long time)

  • The biggest problem was with propagation of events, Enter was mistakenly closing dialog in unwanted cases. I can talk about it on Monday if you wish.

While I introduces allowCloseOnBackdropClick and allowCloseOnEscapeKey, I am thinking about allowProceedOnEnterKey (or something like that) to disable Enter functionality which can be unwanted in some scenarios.

@bedrich-schindler
Copy link
Contributor Author

Just for info, tests need to be updated in #545 as new test environment is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Breaking change feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

In docs Modal is not dismissed by pressing Esc Use native <dialog> element for Modal
4 participants