fix: disabled btn with link should not be focused (#45910)

* fix: disabled btn with link should not be focused

* chore: update snapshot

* chore: update snapshot
This commit is contained in:
MadCcc 2023-11-16 11:36:51 +08:00 committed by GitHub
parent f0a2695df9
commit 2dda417e29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 0 deletions

View File

@ -898,6 +898,7 @@ Array [
<a
class="ant-btn ant-btn-default ant-btn-lg ant-btn-icon-only"
href="https://www.google.com"
tabindex="0"
>
<span
class="ant-btn-icon"
@ -1072,6 +1073,7 @@ exports[`renders components/button/demo/disabled.tsx extend context correctly 1`
<a
class="ant-btn ant-btn-primary"
href="https://ant.design/index-cn"
tabindex="0"
>
<span>
Href Primary
@ -1080,6 +1082,7 @@ exports[`renders components/button/demo/disabled.tsx extend context correctly 1`
<a
class="ant-btn ant-btn-primary ant-btn-disabled"
href="https://ant.design/index-cn"
tabindex="-1"
>
<span>
Href Primary(disabled)
@ -1550,6 +1553,7 @@ exports[`renders components/button/demo/icon.tsx extend context correctly 1`] =
<a
class="ant-btn ant-btn-default ant-btn-icon-only"
href="https://www.google.com"
tabindex="0"
>
<span
class="ant-btn-icon"

View File

@ -805,6 +805,7 @@ Array [
<a
class="ant-btn ant-btn-default ant-btn-lg ant-btn-icon-only"
href="https://www.google.com"
tabindex="0"
>
<span
class="ant-btn-icon"
@ -977,6 +978,7 @@ exports[`renders components/button/demo/disabled.tsx correctly 1`] = `
<a
class="ant-btn ant-btn-primary"
href="https://ant.design/index-cn"
tabindex="0"
>
<span>
Href Primary
@ -985,6 +987,7 @@ exports[`renders components/button/demo/disabled.tsx correctly 1`] = `
<a
class="ant-btn ant-btn-primary ant-btn-disabled"
href="https://ant.design/index-cn"
tabindex="-1"
>
<span>
Href Primary(disabled)
@ -1375,6 +1378,7 @@ exports[`renders components/button/demo/icon.tsx correctly 1`] = `
<a
class="ant-btn ant-btn-default ant-btn-icon-only"
href="https://www.google.com"
tabindex="0"
>
<span
class="ant-btn-icon"

View File

@ -383,6 +383,7 @@ exports[`Button should support link button 1`] = `
<a
class="ant-btn ant-btn-default"
href="https://ant.design"
tabindex="0"
target="_blank"
>
<span>

View File

@ -263,6 +263,7 @@ const InternalButton: React.ForwardRefRenderFunction<
style={fullStyle}
onClick={handleClick}
ref={buttonRef as React.Ref<HTMLAnchorElement>}
tabIndex={mergedDisabled ? -1 : 0}
>
{iconNode}
{kids}

View File

@ -46,6 +46,7 @@ exports[`DropdownButton should support href like Button 1`] = `
<a
class="ant-btn ant-btn-default ant-btn-compact-item ant-btn-compact-first-item"
href="https://ant.design"
tabindex="0"
/>
<button
class="ant-btn ant-btn-default ant-btn-icon-only ant-btn-compact-item ant-btn-compact-last-item ant-dropdown-trigger"

View File

@ -293,6 +293,7 @@ exports[`renders components/flex/demo/combination.tsx extend context correctly 1
<a
class="ant-btn ant-btn-primary"
href="https://ant.design"
tabindex="0"
target="_blank"
>
<span>

View File

@ -289,6 +289,7 @@ exports[`renders components/flex/demo/combination.tsx correctly 1`] = `
<a
class="ant-btn ant-btn-primary"
href="https://ant.design"
tabindex="0"
target="_blank"
>
<span>