PluginProbe
Code Snippets / trunk
Code Snippets vtrunk
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
← All changes | js/components/common/Notice.tsx +8 -1 4.0.0-beta.1 → trunk View file →
@@ -10,10 +10,17 @@
10 10 children?: ReactNode
11 11 type?: NoticeType
12 12 }
13 13
14 +const isAssertive = (type?: NoticeType): boolean => 'error' === type || 'warning' === type
15 +
14 16 export const Notice: React.FC<NoticeProps> = ({ className, type, children, ...props }) =>
15 - <div className={classnames('notice', { [`notice-${type}`]: type }, className)} {...props}>
17 + <div
18 + className={classnames('notice', 'code-snippets-notice', { [`notice-${type}`]: type }, className)}
19 + role={isAssertive(type) ? 'alert' : 'status'}
20 + aria-live={isAssertive(type) ? 'assertive' : 'polite'}
21 + {...props}
22 + >
16 23 {children}
17 24 </div>
18 25
19 26 export interface DismissibleNoticeProps extends NoticeProps {