-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update KAIO version of the FMS to reflect recent fix to accessible ti…
…tles (#3996) * add changes from the FMS legacy to the KAIO verison * clean up story * run linter and add changes
- Loading branch information
1 parent
4577248
commit d91bfe0
Showing
7 changed files
with
283 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
"@kaizen/components": minor | ||
--- | ||
|
||
Update FilterMultiSelect ListBoxSection to avoid duplicate reading of sectionName as the accessible title. | ||
|
||
- Update sectionName to be optional if sectionHeader is provided | ||
- This will solve the issue of sectionName and sectionHeader being read twice when they are the same | ||
- Minor style change to ensure hide bullet lists as filtering | ||
- Minor style changes to allow for default text styles for section headings with just text | ||
- Add conditional check to render the sectionName only if provided | ||
- Add tests to validate type accessible names are constructed as expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../components/src/FilterMultiSelect/subcomponents/ListBoxSection/ListBoxSection.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
@import "~@kaizen/design-tokens/sass/typography"; | ||
@import "~@kaizen/design-tokens/sass/color"; | ||
@import "~@kaizen/design-tokens/sass/spacing"; | ||
|
||
.listBoxSection { | ||
display: grid; | ||
list-style: none; | ||
padding: 0; | ||
} | ||
|
||
.listBoxSectionHeader { | ||
font-family: $typography-heading-6-font-family; | ||
font-size: $typography-heading-6-font-size; | ||
font-weight: $typography-heading-6-font-weight; | ||
line-height: $typography-heading-6-line-height; | ||
color: rgba($color-purple-800-rgb, 0.7); | ||
margin: $spacing-6 0; | ||
} |
50 changes: 50 additions & 0 deletions
50
...ges/components/src/FilterMultiSelect/subcomponents/ListBoxSection/ListBoxSection.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from "react" | ||
import { render } from "@testing-library/react" | ||
import { ListBoxSection } from "./ListBoxSection" | ||
|
||
describe("<ListBoxSection />", () => { | ||
describe("sectionName only", () => { | ||
it("will only have aria-label", () => { | ||
const { getByRole } = render( | ||
<ListBoxSection sectionName="Test sectionName only" items={[]}> | ||
{() => undefined} | ||
</ListBoxSection> | ||
) | ||
const group = getByRole("group") | ||
expect(group).toHaveAttribute("aria-label", "Test sectionName only") | ||
expect(group).not.toHaveTextContent("Test sectionName only") | ||
}) | ||
}) | ||
|
||
describe("sectionHeader only", () => { | ||
it("will have sectionHeader content", () => { | ||
const { getByRole } = render( | ||
<ListBoxSection sectionHeader="Test sectionHeader only" items={[]}> | ||
{() => undefined} | ||
</ListBoxSection> | ||
) | ||
const group = getByRole("group", { name: "Test sectionHeader only" }) | ||
expect(group).toBeInTheDocument() | ||
expect(group).toHaveTextContent("Test sectionHeader only") | ||
}) | ||
}) | ||
|
||
describe("sectionHeader and sectionName", () => { | ||
it("will have combined accessible name", () => { | ||
const { getByRole } = render( | ||
<ListBoxSection | ||
sectionName="Hidden group name" | ||
sectionHeader="sectionHeader name" | ||
items={[]} | ||
> | ||
{() => undefined} | ||
</ListBoxSection> | ||
) | ||
const group = getByRole("group", { | ||
name: "Hidden group name. sectionHeader name", | ||
}) | ||
expect(group).toBeInTheDocument() | ||
expect(group).toHaveTextContent("Hidden group name. sectionHeader name") | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.