Skip to content

Commit

Permalink
fix: #button with href (anchor) had a broken style on active/focus state
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Feb 15, 2019
1 parent ad0ca4e commit a3e263d
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class Example extends PureComponent {
title="This is a link"
icon_position="right"
icon="chevron_right"
data-dnb-test="button-anchor"
/>
<Button
variant="secondary"
Expand All @@ -105,7 +106,7 @@ class Example extends PureComponent {
/>
`}
</ComponentBox>
<ComponentBox scope={{ question }}>
<ComponentBox scope={{ question }} caption="Button with Icon only">
{/* @jsx */ `
<Button
title="Disabled Icon only Button"
Expand All @@ -123,7 +124,6 @@ class Example extends PureComponent {
title="Button with custom, Secondary Icon only"
icon={question}
/>
<p className="example-caption">Button with Icon only</p>
`}
</ComponentBox>
<ComponentBox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ describe('Button screenshot', () => {
})
expect(screenshot).toMatchImageSnapshot()
})
it('have to match primary button with href', async () => {
const screenshot = await testPageScreenshot({
selector: '[data-dnb-test="button-anchor"]'
})
expect(screenshot).toMatchImageSnapshot()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -783,5 +783,7 @@ a.dnb-button {
transform: translateY(0); }
a.dnb-button .dnb-button__text {
transform: translateY(1px); }
a.dnb-button:active, a.dnb-button:focus {
border-radius: var(--button-border-radius); }
"
`;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/dnb-ui-lib/src/components/button/style/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,9 @@ a.dnb-button {
.dnb-button__text {
transform: translateY(1px);
}

&:active,
&:focus {
border-radius: var(--button-border-radius);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ a.dnb-button {
transform: translateY(0); }
a.dnb-button .dnb-button__text {
transform: translateY(1px); }
a.dnb-button:active, a.dnb-button:focus {
border-radius: var(--button-border-radius); }
/*
* DNB FormLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,8 @@ a.dnb-button {
transform: translateY(0); }
a.dnb-button .dnb-button__text {
transform: translateY(1px); }
a.dnb-button:active, a.dnb-button:focus {
border-radius: var(--button-border-radius); }
/*
* DNB FormLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,8 @@ a.dnb-button {
transform: translateY(0); }
a.dnb-button .dnb-button__text {
transform: translateY(1px); }
a.dnb-button:active, a.dnb-button:focus {
border-radius: var(--button-border-radius); }
/*
* DNB FormLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ a.dnb-button {
transform: translateY(0); }
a.dnb-button .dnb-button__text {
transform: translateY(1px); }
a.dnb-button:active, a.dnb-button:focus {
border-radius: var(--button-border-radius); }
.dnb-modal {
font-family: sans-serif;
Expand Down
1 change: 1 addition & 0 deletions packages/dnb-ui-lib/stories/componentsStories.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ stories.push([
text="Secondary button with href"
href="?no-cache=1"
icon="add"
onClick={e => e.preventDefault()}
/>
</Box>
<Box>
Expand Down

0 comments on commit a3e263d

Please sign in to comment.