Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(components/atom/tag): make atom tag focusable when it becomes a button #2739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.13
20.13.0
4 changes: 2 additions & 2 deletions components/atom/tag/src/Actionable/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {LINK_TYPES} from '../constants.js'
*/
const ActionableTagContainer = forwardRef(
({Link, href, target, rel, readOnly, disabled, children, ...props}, forwardedRef) => {
const Component = href !== undefined ? Link : 'span'
const Component = href !== undefined ? Link : 'button'
return (
<Component
ref={forwardedRef}
{...(href ? {href, target, rel} : {role: 'button'})}
{...(href ? {href, target, rel} : {})}
{...(disabled && {'aria-disabled': disabled})}
{...(readOnly && !disabled && {'aria-readonly': readOnly})}
{...props}
Expand Down
4 changes: 2 additions & 2 deletions components/atom/tag/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe(json.name, () => {
})
})
describe('Button', () => {
it('given an href should render a link', () => {
it('given no href should render a button', () => {
// Given
const props = {
label: 'label',
Expand All @@ -146,7 +146,7 @@ describe(json.name, () => {

// Then
expect(tagElement.innerHTML).to.be.a('string')
expect(tagElement.nodeName).to.equal('SPAN')
expect(tagElement.nodeName).to.equal('BUTTON')
})
})
})
Expand Down
Loading