Skip to content
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(ui5-breadcrumbs): current link aria-current #9668

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/base/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type AccessibilityAttributes = {
name?: string,
role?: ARIARoles,
ariaKeyShortcuts?: string,
current?: "page" | "step" | "location" | "date" | "time" | "true" | "false" | boolean
}

export type {
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/Breadcrumbs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
id="{{this._id}}-link"
design="{{this._linkDesign}}"
accessible-name="{{this._accessibleNameText}}"
.accessibilityAttributes="{{this.accessibilityAttributes}}"
data-ui5-stable="{{this.stableDomRef}}"
wrapping-type="None">
{{this.innerText}}
Expand Down
7 changes: 7 additions & 0 deletions packages/main/src/BreadcrumbsItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
import type { AccessibilityAttributes } from "@ui5/webcomponents-base/dist/types.js";
import LinkDesign from "./types/LinkDesign.js";

/**
Expand Down Expand Up @@ -74,6 +75,12 @@ class BreadcrumbsItem extends UI5Element {
get _linkDesign() {
return this._isCurrentPageItem ? LinkDesign.Emphasized : LinkDesign.Default;
}

get accessibilityAttributes(): Pick<AccessibilityAttributes, "current"> {
return {
current: this._isCurrentPageItem ? "page" : false,
};
}
}

BreadcrumbsItem.define();
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/Link.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
aria-label="{{ariaLabelText}}"
aria-haspopup="{{_hasPopup}}"
aria-expanded="{{accessibilityAttributes.expanded}}"
aria-current="{{accessibilityAttributes.current}}"
@focusin={{_onfocusin}}
@focusout={{_onfocusout}}
@click={{_onclick}}
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type LinkClickEventDetail = {
shiftKey: boolean;
}

type LinkAccessibilityAttributes = Pick<AccessibilityAttributes, "expanded" | "hasPopup">;
type LinkAccessibilityAttributes = Pick<AccessibilityAttributes, "expanded" | "hasPopup" | "current">;

/**
* @class
Expand Down