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-multi-combobox): enhance accessibility on mobile #8096

Merged
merged 1 commit into from
Jan 14, 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
5 changes: 5 additions & 0 deletions packages/main/src/MultiComboBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ import {
VALUE_STATE_TYPE_WARNING,
INPUT_SUGGESTIONS_TITLE,
SELECT_OPTIONS,
SHOW_SELECTED_BUTTON,
MULTICOMBOBOX_DIALOG_OK_BUTTON,
VALUE_STATE_ERROR_ALREADY_SELECTED,
} from "./generated/i18n/i18n-defaults.js";
Expand Down Expand Up @@ -1712,6 +1713,10 @@ class MultiComboBox extends UI5Element {
return MultiComboBox.i18nBundle.getText(SELECT_OPTIONS);
}

get _showSelectedButtonAccessibleNameText() {
return MultiComboBox.i18nBundle.getText(SHOW_SELECTED_BUTTON);
}

get _dialogOkButton() {
return MultiComboBox.i18nBundle.getText(MULTICOMBOBOX_DIALOG_OK_BUTTON);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/main/src/MultiComboBoxPopover.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
icon="multiselect-all"
design="Transparent"
?pressed={{_showAllItemsButtonPressed}}
@click="{{filterSelectedItems}}">
@click="{{filterSelectedItems}}"
accessible-name="{{_showSelectedButtonAccessibleNameText}}">
</ui5-toggle-button>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions packages/main/src/i18n/messagebundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ SELECT_ROLE_DESCRIPTION=Listbox
#XTXT: MultiComboBox and ComboBox icon accessible name
SELECT_OPTIONS=Select Options

#XTXT: MultiComboBox show selected items button accessible name
SHOW_SELECTED_BUTTON=Show Selected Items Only

#XBUT: A link that can be clicked to display more/all items
INPUT_SUGGESTIONS=Suggestions available

Expand Down
28 changes: 28 additions & 0 deletions packages/main/test/specs/MultiComboBox.mobile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,32 @@ describe("Validation", () => {
assert.strictEqual(await dialogInput.getValue(), "com", "Additional input was not allowed");
});

});

describe("Accessibility", () => {
before(async () => {
await browser.url("test/pages/MultiComboBox.html");
await browser.emulateDevice('iPhone X');
});

it("Show selected toggle button should has accessibleName attribute", async () => {
const multiCombo = await browser.$("#multi1");
const staticAreaItemClassName = await browser.getStaticAreaItemClassName("#multi1");
let resourceBundleText = null;

await multiCombo.scrollIntoView();
await multiCombo.shadow$('input').click();

const toggleSelectedButton = await browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover").$("ui5-toggle-button");

resourceBundleText = await browser.executeAsync(done => {
const mcb = document.getElementById("multi1");
done(mcb.constructor.i18nBundle.getText(window["sap-ui-webcomponents-bundle"].defaultTexts.SHOW_SELECTED_BUTTON));
});

assert.ok(await toggleSelectedButton.isDisplayed(), "Toggle selected items button is displayed");
assert.strictEqual(await toggleSelectedButton.getAttribute("accessible-name"), "Show Selected Items Only", "Correct value is applied")

});

});