Skip to content

Commit

Permalink
fix(button): set aria-pressed to props.isSelected for icon-only ghost (
Browse files Browse the repository at this point in the history
…#7900)

* fix(button): set aria-pressed to props.isSelected for icon-only ghost

* test: update snapshots

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
janhassel and kodiakhq[bot] authored Feb 25, 2021
1 parent 0310add commit e5cb20c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/react/src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const Button = React.forwardRef(function Button(
let otherProps = {
disabled,
type,
'aria-pressed': hasIconOnly && kind === 'ghost' ? isSelected : null,
};
const anchorProps = {
href,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -2132,6 +2133,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -2204,6 +2206,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -2262,6 +2265,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--batch-summary__cancel bx--btn bx--btn--primary"
disabled={false}
onClick={[Function]}
Expand Down Expand Up @@ -2515,6 +2519,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--sm bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -3066,6 +3071,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -3138,6 +3144,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -3210,6 +3217,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -3268,6 +3276,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--batch-summary__cancel bx--btn bx--btn--primary"
disabled={false}
onClick={[Function]}
Expand Down Expand Up @@ -3521,6 +3530,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--sm bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ exports[`DataTable.TableBatchAction should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="custom-class bx--btn bx--btn--primary"
disabled={false}
tabIndex={0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ exports[`DataTable.TableBatchActions should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--batch-summary__cancel bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -93,6 +94,7 @@ exports[`DataTable.TableBatchActions should render 2`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--batch-summary__cancel bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ exports[`ModalWrapper should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="btn-trigger bx--btn bx--btn--primary"
disabled={false}
onClick={[Function]}
Expand Down Expand Up @@ -171,6 +172,7 @@ exports[`ModalWrapper should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--secondary"
disabled={false}
onClick={[Function]}
Expand All @@ -192,6 +194,7 @@ exports[`ModalWrapper should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[Function]}
Expand Down

0 comments on commit e5cb20c

Please sign in to comment.