feat: add aria-* to Spin (#34408)

* feat: add aria

* feat: update other snap

* feat: update logic
This commit is contained in:
黑雨 2022-03-11 15:49:33 +08:00 committed by GitHub
parent 662f3ade06
commit e45fa77eb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 61 additions and 1 deletions

View File

@ -22222,6 +22222,8 @@ exports[`ConfigProvider components Slider prefixCls 1`] = `
exports[`ConfigProvider components Spin configProvider 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="config-spin config-spin-spinning"
>
<span
@ -22245,6 +22247,8 @@ exports[`ConfigProvider components Spin configProvider 1`] = `
exports[`ConfigProvider components Spin configProvider componentSize large 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="config-spin config-spin-spinning"
>
<span
@ -22268,6 +22272,8 @@ exports[`ConfigProvider components Spin configProvider componentSize large 1`] =
exports[`ConfigProvider components Spin configProvider componentSize middle 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="config-spin config-spin-spinning"
>
<span
@ -22291,6 +22297,8 @@ exports[`ConfigProvider components Spin configProvider componentSize middle 1`]
exports[`ConfigProvider components Spin configProvider virtual and dropdownMatchSelectWidth 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -22314,6 +22322,8 @@ exports[`ConfigProvider components Spin configProvider virtual and dropdownMatch
exports[`ConfigProvider components Spin normal 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -22337,6 +22347,8 @@ exports[`ConfigProvider components Spin normal 1`] = `
exports[`ConfigProvider components Spin prefixCls 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="prefix-Spin prefix-Spin-spinning"
>
<span

View File

@ -1131,6 +1131,8 @@ exports[`renders ./components/list/demo/loadmore.md extend context correctly 1`]
>
<div>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span

View File

@ -1131,6 +1131,8 @@ exports[`renders ./components/list/demo/loadmore.md correctly 1`] = `
>
<div>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span

View File

@ -2,6 +2,8 @@
exports[`renders ./components/spin/demo/basic.md extend context correctly 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -25,6 +27,8 @@ exports[`renders ./components/spin/demo/basic.md extend context correctly 1`] =
exports[`renders ./components/spin/demo/custom-indicator.md extend context correctly 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -106,6 +110,8 @@ exports[`renders ./components/spin/demo/inside.md extend context correctly 1`] =
class="example"
>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -188,6 +194,8 @@ exports[`renders ./components/spin/demo/size.md extend context correctly 1`] = `
style="margin-right:16px"
>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-sm ant-spin-spinning"
>
<span
@ -213,6 +221,8 @@ exports[`renders ./components/spin/demo/size.md extend context correctly 1`] = `
style="margin-right:16px"
>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -237,6 +247,8 @@ exports[`renders ./components/spin/demo/size.md extend context correctly 1`] = `
class="ant-space-item"
>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-lg ant-spin-spinning"
>
<span
@ -266,6 +278,8 @@ exports[`renders ./components/spin/demo/tip.md extend context correctly 1`] = `
>
<div>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning ant-spin-show-text"
>
<span

View File

@ -2,6 +2,8 @@
exports[`renders ./components/spin/demo/basic.md correctly 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -25,6 +27,8 @@ exports[`renders ./components/spin/demo/basic.md correctly 1`] = `
exports[`renders ./components/spin/demo/custom-indicator.md correctly 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -106,6 +110,8 @@ exports[`renders ./components/spin/demo/inside.md correctly 1`] = `
class="example"
>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -188,6 +194,8 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
style="margin-right:16px"
>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-sm ant-spin-spinning"
>
<span
@ -213,6 +221,8 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
style="margin-right:16px"
>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span
@ -237,6 +247,8 @@ exports[`renders ./components/spin/demo/size.md correctly 1`] = `
class="ant-space-item"
>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-lg ant-spin-spinning"
>
<span
@ -266,6 +278,8 @@ exports[`renders ./components/spin/demo/tip.md correctly 1`] = `
>
<div>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning ant-spin-show-text"
>
<span

View File

@ -8,6 +8,8 @@ exports[`Spin if indicator set null should not be render default indicator 1`] =
wrapperClassName=""
>
<div
aria-busy={true}
aria-live="polite"
className="ant-spin ant-spin-spinning"
/>
</Spin>
@ -15,6 +17,8 @@ exports[`Spin if indicator set null should not be render default indicator 1`] =
exports[`Spin rtl render component should be rendered correctly in RTL direction 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning ant-spin-rtl"
>
<span
@ -38,6 +42,8 @@ exports[`Spin rtl render component should be rendered correctly in RTL direction
exports[`Spin should render custom indicator when it's set 1`] = `
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<div
@ -53,6 +59,8 @@ exports[`Spin should support static method Spin.setDefaultIndicator 1`] = `
wrapperClassName=""
>
<div
aria-busy={true}
aria-live="polite"
className="ant-spin ant-spin-spinning"
>
<em

View File

@ -159,7 +159,13 @@ class Spin extends React.Component<SpinProps, SpinState> {
const divProps = omit(restProps, ['spinning', 'delay', 'indicator']);
const spinElement = (
<div {...divProps} style={style} className={spinClassName}>
<div
{...divProps}
style={style}
className={spinClassName}
aria-live="polite"
aria-busy={spinning}
>
{renderIndicator(prefixCls, this.props)}
{tip ? <div className={`${prefixCls}-text`}>{tip}</div> : null}
</div>

View File

@ -522,6 +522,8 @@ exports[`Table renders empty table without emptyText when loading 1`] = `
>
<div>
<div
aria-busy="true"
aria-live="polite"
class="ant-spin ant-spin-spinning"
>
<span