@atlaskit/form
Version:
A form allows people to input information.
25 lines (24 loc) • 730 B
JavaScript
import React from 'react';
import { MessageWrapperContext } from './message-context';
/**
* __Message wrapper __
*
* A message wrapper is used to allow assistive technologies, like screen readers, to announce error or
* valid messages. This must be loaded into the DOM before the
* ErrorMessage, ValidMessage is loaded. Otherwise, assistive technologies
* may not render the message.
*
*/
export const MessageWrapper = ({
children
}) => {
const contextValue = {
isWrapper: true
};
return /*#__PURE__*/React.createElement(MessageWrapperContext.Provider, {
value: contextValue
}, /*#__PURE__*/React.createElement("div", {
"aria-live": "polite",
"data-testid": "message-wrapper"
}, children));
};