1717import classNames from "classnames" ;
1818import * as React from "react" ;
1919
20- import { useInteractiveAttributes } from "../../accessibility/useInteractiveAttributes" ;
20+ import {
21+ useInteractiveAttributes ,
22+ type UseInteractiveAttributesOptions ,
23+ } from "../../accessibility/useInteractiveAttributes" ;
2124import { Classes , Utils } from "../../common" ;
2225import { DISPLAYNAME_PREFIX , removeNonHTMLProps } from "../../common/props" ;
2326import { Icon } from "../icon/icon" ;
@@ -50,7 +53,10 @@ Button.displayName = `${DISPLAYNAME_PREFIX}.Button`;
5053export const AnchorButton : React . FC < AnchorButtonProps > = React . forwardRef < HTMLAnchorElement , AnchorButtonProps > (
5154 ( props , ref ) => {
5255 const { href } = props ;
53- const commonProps = useSharedButtonAttributes ( props , ref ) ;
56+ const commonProps = useSharedButtonAttributes ( props , ref , {
57+ defaultTabIndex : 0 ,
58+ disabledTabIndex : - 1 ,
59+ } ) ;
5460
5561 return (
5662 < a
@@ -73,11 +79,12 @@ AnchorButton.displayName = `${DISPLAYNAME_PREFIX}.AnchorButton`;
7379function useSharedButtonAttributes < E extends HTMLAnchorElement | HTMLButtonElement > (
7480 props : E extends HTMLAnchorElement ? AnchorButtonProps : ButtonProps ,
7581 ref : React . Ref < E > ,
82+ options ?: UseInteractiveAttributesOptions ,
7683) {
7784 const { alignText, fill, large, loading = false , minimal, outlined, small } = props ;
7885 const disabled = props . disabled || loading ;
7986
80- const [ active , interactiveProps ] = useInteractiveAttributes ( ! disabled , props , ref ) ;
87+ const [ active , interactiveProps ] = useInteractiveAttributes ( ! disabled , props , ref , options ) ;
8188
8289 const className = classNames (
8390 Classes . BUTTON ,
0 commit comments