-
Notifications
You must be signed in to change notification settings - Fork 77
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
fix(stepper): improves AT Users experience with screen readers #7691
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
12fd938
fix(stepper): improves AT Users experience with screen readers
anveshmekala 7595f3d
remove space
anveshmekala 637948e
add aria-live attr
anveshmekala 8a0eb3a
remove aria-current
anveshmekala 3c6d63c
add support for builtin translation
anveshmekala 29052a8
Merge branch 'main' into anveshmekala/5602-fix-stepper-a11y
anveshmekala bff99b5
refactor
anveshmekala a06c086
add tests
anveshmekala 540c7e5
feedback changes
anveshmekala 57ca2d3
add back t9ncomponent
anveshmekala 3fdecba
Merge branch 'main' into anveshmekala/5602-fix-stepper-a11y
anveshmekala 2f83ef3
Merge branch 'main' into anveshmekala/5602-fix-stepper-a11y
anveshmekala b9c9dc4
remove builtin translation
anveshmekala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...ages/calcite-components/src/components/stepper-item/assets/stepper-item/t9n/messages.json
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,3 @@ | ||
{ | ||
"complete": "Completed step" | ||
} |
3 changes: 3 additions & 0 deletions
3
...s/calcite-components/src/components/stepper-item/assets/stepper-item/t9n/messages_en.json
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,3 @@ | ||
{ | ||
"complete": "Completed step" | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/calcite-components/src/components/stepper-item/resources.ts
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,10 @@ | ||
export const CSS = { | ||
container: "container", | ||
stepperItemContent: "stepper-item-content", | ||
stepperItemDescription: "stepper-item-description", | ||
stepperItemHeader: "stepper-item-header", | ||
stepperItemHeading: "stepper-item-heading", | ||
stepperItemHeaderText: "stepper-item-header-text", | ||
stepperItemNumber: "stepper-item-number", | ||
visuallyHidden: "visually-hidden", | ||
}; |
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 |
---|---|---|
|
@@ -348,4 +348,8 @@ | |
} | ||
} | ||
|
||
.visually-hidden { | ||
@apply sr-only; | ||
} | ||
|
||
@include base-component(); |
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
3 changes: 3 additions & 0 deletions
3
packages/calcite-components/src/components/stepper/assets/stepper/t9n/messages.json
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,3 @@ | ||
{ | ||
"label": "Progress steps" | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/calcite-components/src/components/stepper/assets/stepper/t9n/messages_en.json
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,3 @@ | ||
{ | ||
"label": "Progress steps" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,15 @@ import { | |
Event, | ||
EventEmitter, | ||
h, | ||
Host, | ||
Listen, | ||
Method, | ||
Prop, | ||
VNode, | ||
Watch, | ||
} from "@stencil/core"; | ||
|
||
import { focusElementInGroup } from "../../utils/dom"; | ||
import { focusElementInGroup, slotChangeGetAssignedElements } from "../../utils/dom"; | ||
import { NumberingSystem } from "../../utils/locale"; | ||
import { Layout, Scale } from "../interfaces"; | ||
import { StepperItemChangeEventDetail, StepperItemKeyEventDetail } from "./interfaces"; | ||
|
@@ -112,17 +113,9 @@ export class Stepper { | |
|
||
render(): VNode { | ||
return ( | ||
<slot | ||
onSlotchange={(event: Event) => { | ||
const items = (event.currentTarget as HTMLSlotElement) | ||
.assignedElements() | ||
.filter((el) => el?.tagName === "CALCITE-STEPPER-ITEM"); | ||
const spacing = Array(items.length).fill("1fr").join(" "); | ||
this.el.style.gridTemplateAreas = spacing; | ||
this.el.style.gridTemplateColumns = spacing; | ||
this.setStepperItemNumberingSystem(); | ||
}} | ||
/> | ||
<Host aria-label={"Progress steps"} role="region"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aria-label should reference message There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should reference the messages now right? |
||
<slot onSlotchange={this.handleDefaultSlotChange} /> | ||
</Host> | ||
); | ||
} | ||
|
||
|
@@ -331,4 +324,13 @@ export class Stepper { | |
item.numberingSystem = this.numberingSystem; | ||
}); | ||
} | ||
|
||
private handleDefaultSlotChange = (event: Event): void => { | ||
const slottedItems = slotChangeGetAssignedElements(event); | ||
const items = slottedItems.filter((el) => el?.tagName === "CALCITE-STEPPER-ITEM"); | ||
const spacing = Array(items.length).fill("1fr").join(" "); | ||
this.el.style.gridTemplateAreas = spacing; | ||
this.el.style.gridTemplateColumns = spacing; | ||
this.setStepperItemNumberingSystem(); | ||
}; | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should reference message here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without
T9nComponent
interface implemented, we cant test the message bundles for all supported locales. Once the translations are back this will be replaced.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added #7759.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should reference the messages now right?