Skip to content

Commit

Permalink
fix: aria-disabled=falseが付かないように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
toshusai committed Oct 20, 2023
1 parent da84270 commit 3398cb4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`Basic <Button>Hello</Button> 1`] = `
.c0 {
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
Expand All @@ -20,7 +21,11 @@ exports[`Basic <Button>Hello</Button> 1`] = `
margin: 0;
overflow: visible;
text-transform: none;
cursor: pointer;
}
.c0:disabled,
.c0[aria-disabled]:not([aria-disabled=false]) {
cursor: default;
}
.c0:focus {
Expand All @@ -32,11 +37,6 @@ exports[`Basic <Button>Hello</Button> 1`] = `
padding: 0;
}
.c0:disabled,
.c0[aria-disabled]:not([aria-disabled=false]) {
cursor: default;
}
.c1 {
width: -webkit-min-content;
width: -moz-min-content;
Expand Down Expand Up @@ -125,23 +125,41 @@ exports[`Basic <Button>Hello</Button> 1`] = `

exports[`Link <Button to="#">Hello</Button> 1`] = `
.c0 {
color: inherit;
cursor: pointer;
}
.c0:focus {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: transparent;
padding: 0;
border-style: none;
outline: none;
}
.c0 .text {
top: calc(1em + 2em);
color: inherit;
text-rendering: inherit;
-webkit-letter-spacing: inherit;
-moz-letter-spacing: inherit;
-ms-letter-spacing: inherit;
letter-spacing: inherit;
word-spacing: inherit;
font: inherit;
margin: 0;
overflow: visible;
text-transform: none;
}
.c0:disabled,
.c0[aria-disabled]:not([aria-disabled=false]) {
cursor: default;
}
.c0:focus {
outline: none;
}
.c0::-moz-focus-inner {
border-style: none;
padding: 0;
}
.c1 {
width: -webkit-min-content;
width: -moz-min-content;
Expand Down Expand Up @@ -221,7 +239,6 @@ exports[`Link <Button to="#">Hello</Button> 1`] = `
}
<a
aria-disabled={false}
className="c0 c1"
href="#"
>
Expand Down
7 changes: 6 additions & 1 deletion packages/react/src/components/Clickable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ const Clickable = React.forwardRef<ClickableElement, ClickableProps>(
const isLink = 'to' in props
const as = isLink ? Link : 'button'
const ariaDisabled = isLink && props.disabled === true ? true : undefined
let rest = props
if (isLink) {
const { disabled, ..._rest } = props
rest = _rest
}
return (
<StyledClickableDiv
{...props}
{...rest}
ref={ref}
as={as}
aria-disabled={ariaDisabled}
Expand Down

0 comments on commit 3398cb4

Please sign in to comment.