Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

Commit

Permalink
fix button a11y check issues
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenhmarsh committed Dec 27, 2021
1 parent e380cc5 commit eca9330
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .storybook/helpers/backgroundOverride.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scssExports from "../../src/global/exports.scss";

// This is only needed because Chromatic does not (yet) support snapshot tests that respect the backgrounds add-on

const backgroundOverride = (color = scssExports.colorGrey500) => html`<style>
const backgroundOverride = (color = scssExports.colorGrey900) => html`<style>
.sb-show-main {
background: ${color};
}
Expand Down
5 changes: 2 additions & 3 deletions src/global/buttons/primary/primary.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const buttonStoryTemplate = (options) => {
};

return html`
${finalOptions.styleMode === "Ghost-Light" ? backgroundOverride() : ""}
${viewMode == "Give it some breathing room" ? "<div class='_sb-breathing-room'>" : ""}
${finalOptions.elementTag === "Anchor"
Expand All @@ -102,15 +103,14 @@ const buttonStoryTemplate = (options) => {

const anchorTagTemplate = (options) => {
return html`
${backgroundOverride()}
<a
class="button primary-button
primary-button--${options.sizeMode.toLowerCase()}
primary-button--${options.styleMode.toLowerCase()}
${options.state === "Hover" ? "_sb--hover" : ""}
${options.state === "Focus" ? "_sb--focus" : ""}"
role="button"
tabindex="1"
tabindex="0"
${options.state === "Inactive" ? "disabled" : ""}
>
${text("Label", "Primary Button")}
Expand All @@ -120,7 +120,6 @@ const anchorTagTemplate = (options) => {

const buttonTagTemplate = (options) => {
return html`
${backgroundOverride()}
<button
class="button primary-button
primary-button--${options.sizeMode.toLowerCase()}
Expand Down
4 changes: 2 additions & 2 deletions src/global/buttons/secondary/secondary.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const buttonStoryTemplate = (options) => {


return html`
${backgroundOverride()}
${finalOptions.styleMode === "Ghost-Light" ? backgroundOverride() : ""}
${viewMode == "Give it some breathing room" ? "<div class='_sb-breathing-room'>" : ""}
Expand All @@ -96,7 +96,7 @@ const anchorTagTemplate = (options) => {
${options.state === "Hover" ? "_sb--hover" : ""}
${options.state === "Focus" ? "_sb--focus" : ""}"
role="button"
tabindex="1"
tabindex="0"
${options.state === "Inactive" ? "disabled" : ""}
>
${text("Label", "Secondary Button")}
Expand Down

0 comments on commit eca9330

Please sign in to comment.