Skip to content

Commit

Permalink
Merge branch 'master' into users/scomea/picker-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdholt authored Jul 17, 2023
2 parents 5b2fd0d + b5f23eb commit dc6a0f0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "fix: add aria-orientation to divider only when role equals separator",
"packageName": "@microsoft/fast-foundation",
"email": "chhol@microsoft.com",
"dependentChangeType": "prerelease"
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,30 @@ test.describe("Divider", () => {
DividerOrientation.horizontal
);
});

test("should NOT set the `aria-orientation` attribute equal to the `orientation` value if the `role` is presentational", async () => {
await root.evaluate(node => {
node.innerHTML = /* html */ `
<fast-divider orientation="vertical"></fast-divider>
`;
});

await expect(element).toHaveAttribute(
"aria-orientation",
DividerOrientation.vertical
);

await element.evaluate((node: FASTDivider, DividerRole) => {
node.role = DividerRole.presentation;
}, DividerRole);

await expect(element).not.toHaveAttribute(
"aria-orientation",
DividerOrientation.horizontal
);
await expect(element).not.toHaveAttribute(
"aria-orientation",
DividerOrientation.vertical
);
});
});
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { ElementViewTemplate, html } from "@microsoft/fast-element";
import type { FASTDivider } from "./divider.js";
import { DividerRole } from "./divider.options.js";

/**
* The template for the {@link @microsoft/fast-foundation#FASTDivider} component.
* @public
*/
export function dividerTemplate<T extends FASTDivider>(): ElementViewTemplate<T> {
return html<T>`
<template role="${x => x.role}" aria-orientation="${x => x.orientation}">
<template
role="${x => x.role}"
aria-orientation="${x =>
x.role !== DividerRole.presentation ? x.orientation : void 0}"
>
<slot></slot>
</template>
`;
Expand Down

0 comments on commit dc6a0f0

Please sign in to comment.