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

Adds content to alert group react examples. #7763

Merged
merged 6 commits into from
Sep 7, 2022

Conversation

edonehoo
Copy link
Contributor

Makes progress on patternfly/patternfly-org#2990

@edonehoo edonehoo self-assigned this Jul 27, 2022
@patternfly-build
Copy link
Contributor

patternfly-build commented Jul 27, 2022

@thatblindgeye thatblindgeye self-requested a review July 28, 2022 19:44
Copy link
Contributor

@thatblindgeye thatblindgeye left a 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?

Comment on lines 59 to 64
**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"
```
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Member

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.

Comment on lines 30 to 32
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`.
Copy link
Contributor

@thatblindgeye thatblindgeye Aug 22, 2022

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)

Suggested change
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.

Comment on lines 16 to 17
| 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.|
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
| 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.

| 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.
Copy link
Contributor

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:

Suggested change
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).

@edonehoo
Copy link
Contributor Author

edonehoo commented Aug 24, 2022

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!

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

🎉 This looks great!

Copy link
Contributor

@nicolethoen nicolethoen left a 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

@wolfeallison
Copy link
Collaborator

Looks great to me!

Copy link
Member

@mcarrano mcarrano left a 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 !

@nicolethoen nicolethoen merged commit 9ceeee9 into patternfly:main Sep 7, 2022
@patternfly-build
Copy link
Contributor

Your changes have been released in:

Thanks for your contribution! 🎉

@edonehoo edonehoo deleted the iss2990-alertgroup branch September 8, 2022 16:10
andyyvo pushed a commit to andyyvo/patternfly-react that referenced this pull request Sep 9, 2022
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants