-
Notifications
You must be signed in to change notification settings - Fork 76
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: properly set aria attributes on components #10404
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,11 +243,7 @@ export class TableCell | |
tabIndex={staticCell ? -1 : 0} | ||
> | ||
{(this.selectionCell || this.readCellContentsToAT) && ( | ||
<span | ||
aria-hidden={true} | ||
aria-live={this.focused ? "polite" : "off"} | ||
class={CSS.assistiveText} | ||
> | ||
<span aria-live={this.focused ? "polite" : "off"} class={CSS.assistiveText}> | ||
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. screen reader text shouldn't have aria-hidden. |
||
{this.selectionCell && this.selectionText} | ||
{this.readCellContentsToAT && !this.selectionCell && this.contentsText} | ||
</span> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,11 +261,7 @@ export class TableHeader implements LocalizedComponent, LoadableComponent, T9nCo | |
/> | ||
)} | ||
{(this.selectionCell || this.numberCell) && ( | ||
<span | ||
aria-hidden={true} | ||
aria-live={this.focused ? "polite" : "off"} | ||
class={CSS.assistiveText} | ||
> | ||
<span aria-live={this.focused ? "polite" : "off"} class={CSS.assistiveText}> | ||
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. screen reader text shouldn't have aria-hidden. |
||
{this.screenReaderText} | ||
</span> | ||
)} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,11 @@ import { | |
} from "@stencil/core"; | ||
import { LocalizedComponent } from "../../utils/locale"; | ||
import { Alignment, Scale, SelectionMode } from "../interfaces"; | ||
import { focusElementInGroup, FocusElementInGroupDestination } from "../../utils/dom"; | ||
import { | ||
focusElementInGroup, | ||
FocusElementInGroupDestination, | ||
toAriaBoolean, | ||
} from "../../utils/dom"; | ||
import { RowType, TableInteractionMode, TableRowFocusEvent } from "../table/interfaces"; | ||
import { isActivationKey } from "../../utils/key"; | ||
import { | ||
|
@@ -410,7 +414,7 @@ export class TableRow implements InteractiveComponent, LocalizedComponent { | |
<InteractiveContainer disabled={this.disabled}> | ||
<tr | ||
aria-rowindex={this.positionAll + 1} | ||
aria-selected={this.selected} | ||
aria-selected={toAriaBoolean(this.selected)} | ||
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 wasn't doing anything. This fixes it. |
||
class={{ [CSS.lastVisibleRow]: this.lastVisibleRow }} | ||
onKeyDown={this.keyDownHandler} | ||
ref={(el) => (this.tableRowEl = el)} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ import { | |
Prop, | ||
VNode, | ||
} from "@stencil/core"; | ||
import { focusElement, nodeListToArray } from "../../utils/dom"; | ||
import { focusElement, nodeListToArray, toAriaBoolean } from "../../utils/dom"; | ||
import { Scale, SelectionMode } from "../interfaces"; | ||
import { TreeItemSelectDetail } from "../tree-item/interfaces"; | ||
import { getTraversableItems, isTreeItem } from "./utils"; | ||
|
@@ -88,9 +88,9 @@ export class Tree { | |
aria-multiselectable={ | ||
this.child | ||
? undefined | ||
: ( | ||
this.selectionMode === "multiple" || this.selectionMode === "multichildren" | ||
).toString() | ||
: toAriaBoolean( | ||
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.selectionMode === "multiple" || this.selectionMode === "multichildren", | ||
) | ||
} | ||
onKeyDown={this.keyDownHandler} | ||
role={!this.child ? "tree" : undefined} | ||
|
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.
only set aria-expanded when set on host