-
Notifications
You must be signed in to change notification settings - Fork 2.9k
docs(react-drawer): best practices #28040
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
Merged
marcosmoura
merged 9 commits into
microsoft:master
from
marcosmoura:docs/react-drawer-best-practices
Jun 22, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
66a4076
docs: fix JSDoc
marcosmoura 53f9553
docs: add mention to dialog component
marcosmoura 30720be
Merge branch 'master' into docs/react-drawer-best-practices
marcosmoura 77f1427
fix: use summary component
marcosmoura 58265fb
fix: typo
marcosmoura 094ec9f
Merge branch 'master' into docs/react-drawer-best-practices
marcosmoura 9ad8dd3
Discard changes to packages/react-components/react-drawer/src/compone…
marcosmoura ae59100
Discard changes to change/@fluentui-react-drawer-44d8cd26-5c02-4f76-b…
marcosmoura cf6a630
docs: include guidance on which components to pick
marcosmoura File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
20 changes: 14 additions & 6 deletions
20
packages/react-components/react-drawer/stories/Drawer/DrawerBestPractices.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,19 @@ | ||
| ## Best practices | ||
| <details> | ||
| <summary> | ||
| Best practices | ||
| </summary> | ||
|
|
||
| TODO: To be added by a future contribution, when all the implementation of sub components is finished. | ||
| ### DrawerOverlay vs DrawerInline vs Drawer | ||
|
|
||
| ### Do | ||
| - `DrawerOverlay`: Should be used only when the full user attention is required. Uses Dialog component under the hood. | ||
| - `DrawerInline`: Should be used when its content do not require full attention or for navigational elements on a page. | ||
| - `Drawer`: Should only be used when there is a strict need to toggle between overlay and inline modes. This is often useful for responsive design, so depending on the page viewport an inline drawer could become overlay to save screen space. <br><br> | ||
| Drawer is a component that combines both DrawerOverlay and DrawerInline. Although it is technically possible to use Drawer for either inline or overlay modes, it is far better to import and use its adequate component. <br><br> | ||
| As an example, in case there is the need to only use the inline mode, it is better to use `<DrawerInline />` instead of a `<Drawer mode="inline" />`. Drawer would use DrawerInline internally, but also include DrawerOverlay in the mix. And as the DrawerOverlay has a strong dependency on Dialog component, more code would be included in the final build bundle. | ||
|
|
||
| TODO | ||
| ### Accessibility | ||
|
|
||
| ### Don't | ||
| - `DrawerOverlay`: <br>Please refer to the Dialog component to understand the accessibility recommendations and implications. | ||
| - `DrawerInline`: <br>Renders a plain div and do not imply any A11y tags or attributes by default. It accepts all aria attributes and it should be customized depending on its context within a page | ||
|
|
||
| TODO | ||
| </details> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.