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

chore(Alert): Allowed for non header elements to be set at the Alert title #8518

Merged
merged 6 commits into from Jan 24, 2023

Conversation

nicolethoen
Copy link
Contributor

@nicolethoen nicolethoen commented Jan 9, 2023

What: Closes #8402

deprecates the titleHeadingLevel
adds a component prop
updates existing examples on the Alert page to avoid new console warnings and advise the use of the component prop.

Created new issue to track the removal of the deprecated titleHeadingLevel prop: #8519

@patternfly-build
Copy link
Contributor

patternfly-build commented Jan 9, 2023

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.

There were also a few GH lint warnings (similar to my Accordion PR).

@@ -50,7 +50,9 @@ PatternFly supports several properties and variations that can be used to add ex

* As demonstrated in the 3rd and 4th variations below, use the `actionClose` property to add an `<AlertActionCloseButton>` component, which can be used to manage and customize alert dismissals. `actionClose` can be used with or without the presence of `actionLinks`.

* As demonstrated in the 5th and 6th variations below, use the `titleHeadingLevel` property to set the heading level of an alert title. Headings should be ordered by their level and heading levels should not be skipped. For example, a heading of an `h2` level should not be followed directly by an `h4`.
* As demonstrated in the 5th and 6th variations below, use the `component` property to set the element for an alert title.
* If there is no description below the alert title, then the `component` prop could be set to a non-heading element such as a `span` or `div`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit, just to make it more of a recommendation:

Suggested change
* If there is no description below the alert title, then the `component` prop could be set to a non-heading element such as a `span` or `div`.
* If the `description` prop is not passed in, then the `component` prop should be set to a non-heading element such as a `span` or `div`.

We should also open up a followup issue for org to update the a11y docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nicolethoen
Copy link
Contributor Author

There were also a few GH lint warnings (similar to my Accordion PR).

ah yeah - those are old, but I can take a look at seeing about cleaning it up

@@ -175,7 +186,7 @@ export const Alert: React.FunctionComponent<AlertProps> = ({
}, [containsFocus, isMouseOver]);
React.useEffect(() => {
dismissed && onTimeout();
}, [dismissed]);
}, [dismissed, timeoutAnimation]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this was added to the wrong useEffect. onTimeout could be added here to dismiss the GH warning and timeoutAnimation added to the useEffect above this one.

Comment on lines 159 to 164
const calculatedTimeout = timeout === true ? 8000 : Number(timeout);
if (calculatedTimeout > 0) {
const timer = setTimeout(() => setTimedOut(true), calculatedTimeout);
return () => clearTimeout(timer);
}
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

GH is still warning about missing timeout in the dependency array here

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

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

LGTM!

@tlabaj
Copy link
Contributor

tlabaj commented Jan 20, 2023

Just needs a rebase and we can merge.

@tlabaj tlabaj merged commit fe4a894 into patternfly:main Jan 24, 2023
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-code-editor@4.82.112
  • @patternfly/react-core@4.276.5
  • @patternfly/react-docs@5.103.61
  • @patternfly/react-inline-edit-extension@4.86.117
  • demo-app-ts@4.210.6
  • @patternfly/react-table@4.112.38
  • @patternfly/react-topology@4.91.26
  • @patternfly/react-virtualized-extension@4.88.112

Thanks for your contribution! 🎉

@nicolethoen nicolethoen deleted the alert_custom_component branch February 8, 2023 13:54
@nicolethoen nicolethoen restored the alert_custom_component branch February 8, 2023 13:54
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.

Bug - Alert - forcing text to be a heading is causing accessibility issues
6 participants