-
Notifications
You must be signed in to change notification settings - Fork 357
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
Adds content to alert group react examples. #7763
Conversation
Preview: https://patternfly-react-pr-7763.surge.sh A11y report: https://patternfly-react-pr-7763-a11y.surge.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the comments to specific lines below:
- The examples using bold just need to be updated to heading level 3
- My opinion on the flow of examples would be Static Alert Group > Dynamic Alert Group > Toast Alert Group, with toast groups coming off more as a variation of the dynamic group. What do you think @edonehoo?
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
**Multiple dynamic alert group** | ||
|
||
You may generate multiple alerts within a group at once in response to a user action. The following example adds three alerts per button click. | ||
|
||
```ts file="./AlertGroupMultipleDynamic.tsx" | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a followup, I think this example and the "Async alert group" example could be updated to be non-toast. This relates to my general comment made as part of the review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the "async alert group" example - is that only relevant for non-toast? When I turn async on, alerts are added to the queue when I click both the toast alert and inline dynamic generators, but is it only intended for the inline dynamic/non-toast in practice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edonehoo I think that example could be relevant for toast or non-toast, but I don't think we need to show it for both types. This comment was more related to my second point in the first message about a possible flow of examples (Static Alert Group > Dynamic Alert Group > Toast Alert Group). Though it may be better to just mention in the example description how an "async alert group can be applied to both non-toast and toast alert groups" or something along those lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcarrano do you know if the original intent for the Async alert group example was for it to only apply to toast alerts? Looks like when the component was first created that example was a toast group from the beginning, but I'm wondering if that was purposeful or just a choice made in the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think it was by intent. Toast alerts are asynchronous by nature. For inline alerts, sure, you could insert and remove inline alerts within a page dynamically, but I don't recommend that in most cases. The inline alerts usually come as the result of a submit operation or page refresh. Otherwise I think it can be a jarring user experience.
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
Alerts that are asynchronously appended into dynamic `AlertGroups` with `isLiveRegion` will be announced to assistive technology at the moment the change happens, following the strategy used for `aria-atomic`, which defaults to `false`. This means only changes of type `addition` will be announced. | ||
|
||
The following example uses `isLiveRegion` to add toast alerts to a group after a button click, but does not set `aria-atomic` to `addition`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor tweaks here, based on the suggestion I made a bit further down at #7763 (comment)
Alerts that are asynchronously appended into dynamic `AlertGroups` with `isLiveRegion` will be announced to assistive technology at the moment the change happens, following the strategy used for `aria-atomic`, which defaults to `false`. This means only changes of type `addition` will be announced. | |
The following example uses `isLiveRegion` to add toast alerts to a group after a button click, but does not set `aria-atomic` to `addition`. | |
An `AlertGroup` can be turned into a toast group by passing in the `isToast` and `isLiveRegion` properties. Alerts that are asynchronously appended into a toast `AlertGroup` will be announced to assistive technology at the moment the change happens. | |
The following example adds alerts to a toast group after a button is clicked. |
| Toast (dynamic) | Toast alert groups position alerts on top of other content at the top right of the page. | | ||
| Dynamic | Dynamic alert groups appear in line with the page's content flow, often in response to a user action.| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Toast (dynamic) | Toast alert groups position alerts on top of other content at the top right of the page. | | |
| Dynamic | Dynamic alert groups appear in line with the page's content flow, often in response to a user action.| | |
| Toast (dynamic) | Toast alert groups contain alerts that often appear in response to an asynchronous event or user action, and position alerts on top of other content at the top right of the page. | | |
| Dynamic | Dynamic alert groups contain alerts that often appear in response to a user action, and position alert inline with the page's content flow. | |
Or something along those lines. Based on @mcarrano comment above about that async example, adding some verbiage about that here may not be bad. Part of the intent is also to help differentiate when one would want to use a toast alert group since it and the normal dynamic group are fairly similar.
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
| Toast (dynamic) | Toast alert groups position alerts on top of other content at the top right of the page. | | ||
| Dynamic | Dynamic alert groups appear in line with the page's content flow, often in response to a user action.| | ||
|
||
Dynamic alerts are generated after the page initially loads. Additional measures are required to ensure these alerts are accessible to screen readers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit of a tweak here, to combine some verbiage you had elsewhere and bring it up here to a less specific section:
Dynamic alerts are generated after the page initially loads. Additional measures are required to ensure these alerts are accessible to screen readers. | |
Dynamic alerts that are generated after the page initially loads must be appended to either a "toast" or "dynamic" `AlertGroup` and the group must have the `isLiveRegion` prop passed in. | |
By default, only new alerts appended to a toast or dynamic group will be announced by assistive technologies when the `isLiveRegion` prop is passed into the group. For information about customizing this announcement, read the [aria-atomic and aria-relevant](/components/alert-group/accessibility#aria-atomic-and-aria-relevant) section of the alert group accessibility documentation. |
Or something along those lines. Basically the goals I had with this tweak is to make it clear you must pass in isLiveRegion
to the alert group when alerts will be dynamic, and to link to the a11y docs for aria-atomic/aria-relevant (which was originally mentioned further down).
packages/react-core/src/components/AlertGroup/examples/AlertGroup.md
Outdated
Show resolved
Hide resolved
I believe I incorporated all of these ideas, but I also edited (what I thought were) some repetitive/redundant bits, so please let me know if I cut out any important information! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 This looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! This is a huge improvement for Alert Group info
Looks great to me! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Nice work @edonehoo !
Your changes have been released in:
Thanks for your contribution! 🎉 |
* Adds content to alert group react examples. * Adjusts headings. * Updates heading level. * Updates alertgroup content. * Incorporates feedback and edits content for readability and simplicity. * Small wording change.
Makes progress on patternfly/patternfly-org#2990