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

[docs][joy-ui] Revise the "Modal" page #39340

Closed
wants to merge 1 commit into from

Conversation

LadyBluenotes
Copy link
Contributor

So my fork was messed up so I had to redo it lol.

Here's the Modal page I worked on for issue #33998.

If there's anything else I need to do for this, please let me know!

@samuelsycamore

@mui-bot
Copy link

mui-bot commented Oct 8, 2023

Netlify deploy preview

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 7357c5c

@danilo-leal danilo-leal added docs Improvements or additions to the documentation component: modal This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy labels Oct 9, 2023
Copy link
Contributor

@mapache-salvaje mapache-salvaje left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on @LadyBluenotes !! I've added some suggestions throughout—the biggest thing I notice is inconsistency with the naming/styling conventions for components. I pointed it out in a few places earlier in the doc, and would love to see those suggestions applied across the board. Are you able to view this doc from MUI's Handbook? This is a guide I created to try to clarify the product style conventions. Please let me know if anything is unclear.

<p class="description">The modal component provides a solid foundation for creating dialogs, popovers, lightboxes, or whatever else.</p>

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}
<p class="description">The modal component provides a solid foundation for creating dialogs, popovers, lightboxes, and other interactive elements.</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Capital M since we're referring specifically to this lib's component (so, proper noun)

Suggested change
<p class="description">The modal component provides a solid foundation for creating dialogs, popovers, lightboxes, and other interactive elements.</p>
<p class="description">The Modal component provides a solid foundation for creating dialogs, popovers, lightboxes, and other interactive elements.</p>

Joy UI provides three modal-related components:
Modals are interactive dialog boxes or overlays that capture user inputs or present information.

In Joy UI, modals are managed through three related components:

- [`Modal`](#basic-usage): A container that renders its `children` node in front of a backdrop component.
Copy link
Contributor

Choose a reason for hiding this comment

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

We can drop the backticks from these list items (same suggestion goes for the other two below this one) - we only need to use <ComponentCase /> (styled like a React component) when it'd be unclear otherwise

Suggested change
- [`Modal`](#basic-usage): A container that renders its `children` node in front of a backdrop component.
- [Modal](#basic-usage): A container that renders its `children` node in front of a backdrop component.

Comment on lines +25 to +31
The Modal component comes equipped with features designed to improve user interaction and accessibility:

- 🥞 Manages modal stacking when more than one is needed.
- 🪟 Automatically creates a backdrop element to disable interaction with the rest of the app.
- 🔐 Disables page scrolling while open.
- ⌨️ Manages focus correctly between the modal and its parent app.
- ♿️ Adds the appropriate ARIA roles automatically.
- Manages modal stacking when more than one is needed.
- Automatically create a backdrop element to disable interactions with the rest of the app.
- Disables page scrolling when open.
- Manages focus between modal and its parent app.
- Adds appropriate ARIA roles automatically.
Copy link
Contributor

Choose a reason for hiding this comment

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

let's cut this section entirely - I found that we rarely have enough to say to justify a "Features" section on most pages, so I'd rather not have it than apply it inconsistently


## Component
Dialog, on the other hand, can either be _modal_ or _nonmodal (modeless)_, offering more flexibility in user interactions.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Dialog, on the other hand, can either be _modal_ or _nonmodal (modeless)_, offering more flexibility in user interactions.
Dialogs, on the other hand, can either be _modal_ or _nonmodal (modeless)_, offering more flexibility in user interactions.

```

### Basic usage
The `Modal` component is designed to accept just one React element as its child.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The `Modal` component is designed to accept just one React element as its child.
The Modal component is designed to accept just one React element as its child.


#### Variant
### Nesting modals
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
### Nesting modals
### Nesting Modals


The Modal Dialog supports the [global variants](/joy-ui/main-features/global-variants/) feature.
Modal components in Joy UI are able to be nested:
Copy link
Contributor

Choose a reason for hiding this comment

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

passive —> active voice

Suggested change
Modal components in Joy UI are able to be nested:
You can create nested Modals, as shown in the demo below:

{{"demo": "VariantModalDialog.js"}}
:::warning
While it is possible to create nested modals, stacking more than two at a time is discouraged.
Each additional modal further restricts interactions with elements in the background, which renders the previous states inaccessible and complicating the user experience.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Each additional modal further restricts interactions with elements in the background, which renders the previous states inaccessible and complicating the user experience.
Each additional modal further restricts interactions with elements in the background, which renders the previous states inaccessible and complicates the user experience.

The potential triggers are:

- `backdropClick`: the user clicks on the modal's backdrop.
- `escapeKeyDown`: the user presses `Escape` on the keyboard.
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use this nifty lil <kbd class="key"> tag to give it keyboard key styles :)

Suggested change
- `escapeKeyDown`: the user presses `Escape` on the keyboard.
- `escapeKeyDown`: the user presses <kbd class="key">Escape</kbd>.

@@ -129,7 +155,7 @@ const theme = extendTheme({
});
```

For **TypeScript**, you need module augmentation to include the new values to the `layout` prop:
When using TypeScript, module augmentation is required to incorporate the new values into the layout property:
Copy link
Contributor

Choose a reason for hiding this comment

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

We try to avoid using the word "property" when we're specifically referring to "React props"

Suggested change
When using TypeScript, module augmentation is required to incorporate the new values into the layout property:
When using TypeScript, module augmentation is required to incorporate the new values into the `layout` prop:

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 22, 2023
@mapache-salvaje
Copy link
Contributor

Closing here as Joy UI development is currently on hold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: modal This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation package: joy-ui Specific to @mui/joy PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants