Files
redash/client/app/components/BigMessage.jsx
Rafael Wendel fb90b501cb Improve icon a11y (#5424)
* Added screen reader CSS

* Added description to external links

* Added spinner icon accessibility

* Added accessibility to exclamation and big message

* Added question and exclamation accessibility

* Hide decorative icons

* Standardized link design

* Added a11y to refresh icons

* Added aria-label to anchors and buttons

* Added a11y to conditional icons

* Added applicable labels to Ant Icons

* Changed escape to interpolation

* Replaced external links with opens in new tab

* Improved Tooltip hosts

* Added aria live to temporary elements

* Removed mistakenly added redundant helper

* Undoes unnecessarily added interpolation

* Replaced empty label with hidden

* Improved full icon label

* Improved display of live regions

* Added note

* remove unused class

* Created unique id

* Remove TODOs

* Proper action label

* Improved feedback for autocomplete toggle

* feature: add id hook

* refactor: use id hook

* standardize white space
2021-03-22 19:49:36 -03:00

38 lines
934 B
JavaScript

import React from "react";
import PropTypes from "prop-types";
import { useUniqueId } from "@/lib/hooks/useUniqueId";
import cx from "classnames";
function BigMessage({ message, icon, children, className }) {
const messageId = useUniqueId("bm-message");
return (
<div
className={"big-message p-15 text-center " + className}
role="status"
aria-live="assertive"
aria-relevant="additions removals">
<h3 className="m-t-0 m-b-0" aria-labelledby={messageId}>
<i className={cx("fa", icon)} aria-hidden="true" />
</h3>
<br />
<span id={messageId}>{message}</span>
{children}
</div>
);
}
BigMessage.propTypes = {
message: PropTypes.string,
icon: PropTypes.string.isRequired,
children: PropTypes.node,
className: PropTypes.string,
};
BigMessage.defaultProps = {
message: "",
children: null,
className: "tiled bg-white",
};
export default BigMessage;