Skip to content

fix(ui5-rating-indicator): Aria-readonly attribute added #3219

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

Merged
merged 1 commit into from
May 12, 2021
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
2 changes: 1 addition & 1 deletion packages/main/src/RatingIndicator.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
aria-valuemax="{{maxValue}}"
aria-orientation="horizontal"
aria-disabled="{{_ariaDisabled}}"
?aria-readonly="{{readOnly}}"
aria-readonly="{{ariaReadonly}}"
tabindex="{{tabIndex}}"
@focusin="{{_onfocusin}}"
@focusout="{{_onfocusout}}"
Expand Down
4 changes: 4 additions & 0 deletions packages/main/src/RatingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ class RatingIndicator extends UI5Element {
get _ariaDisabled() {
return this.disabled || undefined;
}

get ariaReadonly() {
return this.readonly ? "true" : undefined;
}
}

RatingIndicator.define();
Expand Down
2 changes: 1 addition & 1 deletion packages/main/test/pages/RatingIndicator.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h3>test change event</h3>
<br>

<h3>readonly</h3>
<ui5-rating-indicator value="1" max-value="3" readonly></ui5-rating-indicator>
<ui5-rating-indicator id="rating-indicator-readonly" value="1" max-value="3" readonly></ui5-rating-indicator>
<br>
<br>
<br>
Expand Down
5 changes: 5 additions & 0 deletions packages/main/test/specs/RatingIndicator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ describe("Rating Indicator general interaction", () => {

it("Tests ACC attrs", () => {
const ratingIndicator = browser.$("#rating-indicator1").shadow$(".ui5-rating-indicator-root");
const ratingIndicatorReadOnly = browser.$("#rating-indicator-readonly").shadow$(".ui5-rating-indicator-root");

const TOOLTIP = "Rating";
const ARIA_LABEL = "Hello World";

Expand All @@ -77,5 +79,8 @@ describe("Rating Indicator general interaction", () => {

assert.strictEqual(ratingIndicator.getAttribute("title"), TOOLTIP,
"The default tooltip is displayed");

assert.notOk(ratingIndicator.getAttribute("aria-readonly"), "The aria-readonly attribute is not presented");
assert.strictEqual(ratingIndicatorReadOnly.getAttribute("aria-readonly"), 'true', "The aria-readonly attribute is presented");
});
});